結果

問題 No.1200 お菓子配り-3
ユーザー H3PO4H3PO4
提出日時 2022-01-22 09:38:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 79,684 KB
最終ジャッジ日時 2023-08-18 01:28:32
合計ジャッジ時間 26,547 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,700 KB
testcase_01 AC 96 ms
75,600 KB
testcase_02 AC 80 ms
75,396 KB
testcase_03 AC 82 ms
75,608 KB
testcase_04 AC 80 ms
75,436 KB
testcase_05 AC 82 ms
75,472 KB
testcase_06 AC 77 ms
75,680 KB
testcase_07 AC 97 ms
75,704 KB
testcase_08 AC 99 ms
76,068 KB
testcase_09 AC 114 ms
76,140 KB
testcase_10 AC 96 ms
75,560 KB
testcase_11 AC 96 ms
76,452 KB
testcase_12 AC 239 ms
77,352 KB
testcase_13 AC 240 ms
77,560 KB
testcase_14 AC 241 ms
77,340 KB
testcase_15 AC 243 ms
77,120 KB
testcase_16 AC 243 ms
77,448 KB
testcase_17 AC 649 ms
78,516 KB
testcase_18 AC 874 ms
78,912 KB
testcase_19 AC 270 ms
77,268 KB
testcase_20 AC 1,554 ms
79,000 KB
testcase_21 AC 1,560 ms
79,684 KB
testcase_22 AC 1,804 ms
78,780 KB
testcase_23 AC 1,555 ms
78,920 KB
testcase_24 AC 1,530 ms
78,760 KB
testcase_25 AC 1,542 ms
79,248 KB
testcase_26 AC 1,552 ms
78,748 KB
testcase_27 WA -
testcase_28 AC 1,202 ms
78,288 KB
testcase_29 AC 3,135 ms
78,196 KB
testcase_30 AC 3,140 ms
78,672 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline


def make_divisors(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            yield i
            if i != n // i:
                yield n // i


def solve(X, Y):
    res = 0
    if X == Y: res += X + 1
    for div in make_divisors(abs(X - Y)):
        if (X + Y) % (div + 2):
            continue
        BpC = (X + Y) // (div + 2)
        BmC = abs(X - Y) // div
        if BpC >= BmC and not (BpC & 1) ^ (BmC & 1):
            res += 1
    return res


S = int(input())
for _ in range(S):
    print(solve(*map(int, input().split())))
0