結果
問題 | No.1200 お菓子配り-3 |
ユーザー |
![]() |
提出日時 | 2020-08-28 22:10:30 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,206 bytes |
コンパイル時間 | 349 ms |
コンパイル使用メモリ | 82,592 KB |
実行使用メモリ | 76,696 KB |
最終ジャッジ日時 | 2024-11-14 15:22:59 |
合計ジャッジ時間 | 23,357 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 WA * 3 |
ソースコード
mod = 1000000007eps = 10**-9def main():import sysinput = sys.stdin.buffer.readlinefor _ in range(int(input())):x, y = map(int, input().split())if x < y:x, y = y, xV = x+yW = x-yif W == 0:ans = x - 1for d in range(3, x+1):if d * d > x:breakif x % 3 == 0:ans += 2if d * d == x:ans -= 1if x%2 == 0:ans += 1print(ans)continueans = 0for d in range(1, W+1):if d * d > W:breakif W%d != 0:continueif d*d != W:D = (d, W//d)else:D = (d, )for dd in D:if V % (dd+2) != 0:continueb_c = W // ddbc = V // (dd+2)if (b_c - bc)%2 == 1:continueif bc < b_c:continueans += 1print(ans)if __name__ == '__main__':main()