結果

問題 No.1200 お菓子配り-3
ユーザー tamatotamato
提出日時 2020-08-28 22:10:30
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,206 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,504 KB
実行使用メモリ 76,440 KB
最終ジャッジ日時 2024-04-26 23:20:46
合計ジャッジ時間 23,988 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,060 KB
testcase_01 AC 40 ms
57,452 KB
testcase_02 AC 42 ms
57,860 KB
testcase_03 AC 42 ms
57,992 KB
testcase_04 AC 42 ms
58,108 KB
testcase_05 AC 42 ms
58,736 KB
testcase_06 AC 42 ms
58,272 KB
testcase_07 AC 61 ms
60,960 KB
testcase_08 AC 62 ms
60,248 KB
testcase_09 AC 60 ms
61,408 KB
testcase_10 AC 60 ms
60,476 KB
testcase_11 AC 60 ms
61,240 KB
testcase_12 AC 199 ms
66,704 KB
testcase_13 AC 201 ms
66,200 KB
testcase_14 AC 204 ms
67,056 KB
testcase_15 AC 205 ms
66,344 KB
testcase_16 AC 206 ms
66,916 KB
testcase_17 AC 596 ms
71,668 KB
testcase_18 AC 838 ms
73,640 KB
testcase_19 AC 232 ms
66,828 KB
testcase_20 AC 1,558 ms
76,348 KB
testcase_21 AC 1,601 ms
76,136 KB
testcase_22 AC 1,888 ms
76,324 KB
testcase_23 AC 1,557 ms
76,148 KB
testcase_24 AC 1,544 ms
76,440 KB
testcase_25 AC 1,538 ms
76,284 KB
testcase_26 AC 1,538 ms
76,224 KB
testcase_27 WA -
testcase_28 AC 1,227 ms
76,152 KB
testcase_29 AC 3,373 ms
70,400 KB
testcase_30 AC 3,332 ms
70,812 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