結果

問題 No.1200 お菓子配り-3
ユーザー 👑 tamatotamato
提出日時 2020-08-28 22:10:30
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,206 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 87,444 KB
実行使用メモリ 78,060 KB
最終ジャッジ日時 2023-08-09 08:46:40
合計ジャッジ時間 28,803 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,508 KB
testcase_01 AC 77 ms
75,484 KB
testcase_02 AC 79 ms
75,552 KB
testcase_03 AC 76 ms
75,684 KB
testcase_04 AC 77 ms
75,524 KB
testcase_05 AC 79 ms
75,728 KB
testcase_06 AC 78 ms
75,552 KB
testcase_07 AC 98 ms
76,124 KB
testcase_08 AC 97 ms
75,840 KB
testcase_09 AC 98 ms
75,920 KB
testcase_10 AC 96 ms
76,092 KB
testcase_11 AC 97 ms
75,912 KB
testcase_12 AC 255 ms
76,980 KB
testcase_13 AC 255 ms
76,636 KB
testcase_14 AC 256 ms
76,660 KB
testcase_15 AC 258 ms
76,820 KB
testcase_16 AC 256 ms
77,068 KB
testcase_17 AC 700 ms
76,964 KB
testcase_18 AC 971 ms
77,688 KB
testcase_19 AC 291 ms
76,928 KB
testcase_20 AC 1,778 ms
77,696 KB
testcase_21 AC 1,776 ms
78,060 KB
testcase_22 AC 2,076 ms
77,704 KB
testcase_23 AC 1,778 ms
77,860 KB
testcase_24 AC 1,752 ms
77,768 KB
testcase_25 AC 1,769 ms
77,844 KB
testcase_26 AC 1,766 ms
77,720 KB
testcase_27 WA -
testcase_28 AC 1,406 ms
77,816 KB
testcase_29 AC 3,801 ms
76,992 KB
testcase_30 AC 3,795 ms
77,208 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

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:
            ans = x - 1
            for d in range(3, x+1):
                if d * d > x:
                    break
                if x % 3 == 0:
                    ans += 2
                if d * d == x:
                    ans -= 1
            if x%2 == 0:
                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