結果

問題 No.1200 お菓子配り-3
ユーザー 👑 KazunKazun
提出日時 2020-09-22 22:11:15
言語 PyPy3
(7.3.13)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 676 bytes
コンパイル時間 664 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 81,812 KB
最終ジャッジ日時 2023-09-09 04:46:32
合計ジャッジ時間 36,786 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,296 KB
testcase_01 AC 75 ms
75,244 KB
testcase_02 AC 81 ms
75,392 KB
testcase_03 AC 80 ms
75,188 KB
testcase_04 AC 79 ms
75,312 KB
testcase_05 AC 78 ms
75,400 KB
testcase_06 AC 81 ms
75,336 KB
testcase_07 AC 112 ms
76,256 KB
testcase_08 AC 114 ms
76,268 KB
testcase_09 AC 110 ms
76,312 KB
testcase_10 AC 111 ms
76,224 KB
testcase_11 AC 114 ms
76,328 KB
testcase_12 AC 391 ms
76,664 KB
testcase_13 AC 398 ms
76,764 KB
testcase_14 AC 394 ms
76,656 KB
testcase_15 AC 396 ms
76,944 KB
testcase_16 AC 394 ms
76,632 KB
testcase_17 AC 1,176 ms
77,720 KB
testcase_18 AC 1,657 ms
77,444 KB
testcase_19 AC 457 ms
76,960 KB
testcase_20 AC 3,072 ms
77,652 KB
testcase_21 AC 3,076 ms
77,360 KB
testcase_22 AC 3,624 ms
77,668 KB
testcase_23 AC 3,070 ms
77,584 KB
testcase_24 AC 3,056 ms
77,616 KB
testcase_25 AC 3,077 ms
77,676 KB
testcase_26 AC 3,068 ms
77,628 KB
testcase_27 AC 73 ms
71,024 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#約数全部
def Divisors(N):
    N=abs(N)
    L,U=[],[]
    k=1
    while k*k <=N:
        if N%k== 0:
            L.append(k)
            if k!=N//k:
                U.append(N//k)
        k+=1
    return L+U[::-1]
#====================================
S=int(input())
L=[0]*S

for i in range(S):
    X,Y=map(int,input().split())

    D=Divisors(X+Y)

    K=0
    for d in D:
        if d==1:
            continue
        elif d==2:
            if X==Y:
                K+=X-1
        else:
            A=d-1
            B2=A*X-Y
            C2=-X+A*Y

            if B2>0 and C2>0 and B2%(A*A-1)==C2%(A*A-1)==0:
                K+=1
    L[i]=K

print("\n".join(map(str,L)))
0