結果

問題 No.1200 お菓子配り-3
ユーザー tamatotamato
提出日時 2020-09-04 10:38:03
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,323 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,268 KB
実行使用メモリ 76,744 KB
最終ジャッジ日時 2024-05-01 00:22:28
合計ジャッジ時間 24,358 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,484 KB
testcase_01 AC 41 ms
59,048 KB
testcase_02 AC 44 ms
58,484 KB
testcase_03 AC 44 ms
57,988 KB
testcase_04 AC 44 ms
59,224 KB
testcase_05 AC 46 ms
59,216 KB
testcase_06 AC 45 ms
59,288 KB
testcase_07 AC 62 ms
60,856 KB
testcase_08 AC 62 ms
60,700 KB
testcase_09 AC 63 ms
61,212 KB
testcase_10 AC 63 ms
60,488 KB
testcase_11 AC 60 ms
60,108 KB
testcase_12 AC 208 ms
66,472 KB
testcase_13 AC 211 ms
67,768 KB
testcase_14 AC 207 ms
66,356 KB
testcase_15 AC 210 ms
67,452 KB
testcase_16 AC 208 ms
67,388 KB
testcase_17 AC 609 ms
71,092 KB
testcase_18 AC 860 ms
75,084 KB
testcase_19 AC 239 ms
67,776 KB
testcase_20 AC 1,597 ms
76,500 KB
testcase_21 AC 1,598 ms
76,468 KB
testcase_22 AC 1,864 ms
76,340 KB
testcase_23 AC 1,596 ms
76,672 KB
testcase_24 AC 1,564 ms
76,744 KB
testcase_25 AC 1,582 ms
76,460 KB
testcase_26 AC 1,588 ms
76,280 KB
testcase_27 WA -
testcase_28 AC 1,257 ms
76,468 KB
testcase_29 AC 3,412 ms
71,008 KB
testcase_30 AC 3,400 ms
70,756 KB
testcase_31 AC 38 ms
53,540 KB
testcase_32 AC 38 ms
53,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline

    for _ in range(int(input())):
        x, y = map(int, input().split())
        if x < y:
            x, y = y, x

        V = x+y
        W = x-y

        if W == 0:
            D = []
            for d in range(1, x+1):
                if d * d > x:
                    break
                if x % d == 0:
                    D.append(d)
                    D.append(x // d)
            if D[-1] == D[-2]:
                D.pop()
            ans = x-1
            for d in D:
                if d == 1 or d == 2:
                    continue
                ans += 1
            print(ans)
            continue

        ans = 0
        for d in range(1, W+1):
            if d * d > W:
                break
            if W%d != 0:
                continue
            if d*d != W:
                D = (d, W//d)
            else:
                D = (d, )
            for dd in D:
                if V % (dd+2) != 0:
                    continue
                b_c = W // dd
                bc = V // (dd+2)
                if (b_c - bc)%2 == 1:
                    continue
                if bc < b_c:
                    continue
                ans += 1
        print(ans)


if __name__ == '__main__':
    main()
0