結果
| 問題 | No.1200 お菓子配り-3 |
| コンテスト | |
| ユーザー |
anagohirame
|
| 提出日時 | 2020-08-28 22:18:51 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 643 bytes |
| 記録 | |
| コンパイル時間 | 1,315 ms |
| コンパイル使用メモリ | 208,980 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-13 00:27:27 |
| 合計ジャッジ時間 | 5,450 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int s; scanf("%d", &s);
for (int z = 0; z < s; ++z) {
int x, y; scanf("%d%d", &x, &y);
if (x == y) {
printf("%d\n", x-1);
continue;
}
if (x < y) swap(x, y);
int ans = 0;
for (int i = 1; i*i <= x-y; ++i) {
if ((x-y) % i != 0) continue;
if ((x+y) % (i+2) == 0) {
int p = (x-y) / i; int q = (x+y) / (i+2);
if (p < q and p%2 == q%2) ans++;
}
if (i*i == x-y) continue;
int j = (x-y)/i;
if ((x+y) % (j+2) == 0) {
int p = (x-y) / j; int q = (x+y) / (j+2);
if (p < q and p%2 == q%2) ans++;
}
}
printf("%d\n", ans);
}
return 0;
}
anagohirame