結果
| 問題 |
No.1200 お菓子配り-3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-28 22:44:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 754 bytes |
| コンパイル時間 | 1,809 ms |
| コンパイル使用メモリ | 166,728 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 16:14:56 |
| 合計ジャッジ時間 | 28,228 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int yta();
signed main(){
int s;
scanf("%lld", &s);
while(s--) yta();
return 0;
}
int x, y;
inline int valid(int a){
if(a == 0) return 0;
int sita = a*a-1;
int ue = a*x-y;
if(sita == 0 || ue <= 0 || ue%sita != 0) return 0;
int b = ue/sita;
if(x-a*b <= 0) return 0;
return 1;
}
int yta(){
scanf("%lld %lld", &x, &y);
int ans = 0;
for(int i = 1;i*i <= x+y;i++){
if((x+y)%i == 0){
ans += valid(i-1);
if(i*i < x+y) ans += valid((x+y)/i-1);
}
}
printf("%lld\n", ans);
return 0;
}