結果
問題 |
No.1200 お菓子配り-3
|
ユーザー |
|
提出日時 | 2020-08-28 22:41:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 987 bytes |
コンパイル時間 | 775 ms |
コンパイル使用メモリ | 64,152 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-14 16:09:28 |
合計ジャッジ時間 | 7,626 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 WA * 25 |
ソースコード
#include <iostream> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) using ll = long long; bool f(int x, int y) { if (x / y > 0 && x % y == 0) return true; else return false; } void solve() { int x, y; cin >> x >> y; if (x < y) swap(x, y); int cnt = 0; for (int i = 1; i * i <= x - y; i++) { if ((x - y) % i == 0) { { int a = i + 1; int div = (a + 1) * (a - 1); int b = a * x - y, c = a * y - x; if (f(b, div) && f(c, div)) { cnt++; } } { int a = (x - y) / i + 1; int div = (a + 1) * (a - 1); int b = a * x - y, c = a * y - x; if (f(b, div) && f(c, div)) { cnt++; } } } } cout << cnt << endl; } int main() { int t; cin >> t; rep(i, t) solve(); return 0; }