結果

問題 No.1200 お菓子配り-3
ユーザー KudeKude
提出日時 2020-08-28 22:01:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 76,644 KB
最終ジャッジ日時 2024-11-14 14:52:02
合計ジャッジ時間 25,516 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    x, y = map(int, input().split())
    if x < y:
        x, y = y, x
    p = x + y
    q = x - y
    d = 1
    ans = 0
    while d * d <= q:
        if q % d == 0:
            d2 = q // d
            for s, t in ([(d, d2), (d2, d)] if d != d2 else [(d, d2)]):
                bc = p // (s + 2)
                if p % (s + 2) == 0 and bc & 1 == t & 1 and bc > t:
                    #print(s, t, p, q)
                    ans += 1
        d += 1
    print(ans)
0