結果
| 問題 |
No.1200 お菓子配り-3
|
| コンテスト | |
| ユーザー |
milanis48663220
|
| 提出日時 | 2020-09-01 01:17:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,260 bytes |
| コンパイル時間 | 769 ms |
| コンパイル使用メモリ | 82,504 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 03:02:23 |
| 合計ジャッジ時間 | 6,820 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 WA * 2 |
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
void solve(){
int x, y; cin >> x >> y;
if(x < y) swap(x, y);
if(x == y){
int ans = 0;
// a = 1
ans += x-1;
// b = c
for(int i = 3; i*i <= x; i++){
if(x%i == 0) ans++;
}
cout << ans << endl;
return;
}
int ans = 0;
for(int s = 1; s*s <= x-y; s++){
if((x-y)%s != 0) continue;
{
int t_ = (x-y)/s;
int a = s+1;
if((x+y)%(a+1) == 0){
int t = (x+y)/(a+1);
if(t > t_ && t%2 == t_%2) {
ans++;
}
}
}
if(s*s != x-y){
int t_ = s;
int a = (x-y)/t_+1;
if((x+y)%(a+1) == 0){
int t = (x+y)/(a+1);
if(t > t_ && t%2 == t_%2) {
ans++;
}
}
}
}
cout << ans << endl;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout << setprecision(10) << fixed;
int s; cin >> s;
for(int i = 0; i < s; i++) solve();
}
milanis48663220