結果

問題 No.1200 お菓子配り-3
ユーザー 👑 KazunKazun
提出日時 2020-08-28 22:14:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 613 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 77,124 KB
最終ジャッジ日時 2024-04-26 23:25:05
合計ジャッジ時間 36,680 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,456 KB
testcase_01 AC 40 ms
57,600 KB
testcase_02 AC 44 ms
57,788 KB
testcase_03 AC 44 ms
58,804 KB
testcase_04 AC 43 ms
58,096 KB
testcase_05 AC 47 ms
57,856 KB
testcase_06 AC 43 ms
58,424 KB
testcase_07 AC 72 ms
60,724 KB
testcase_08 AC 72 ms
60,704 KB
testcase_09 AC 70 ms
60,588 KB
testcase_10 AC 73 ms
61,272 KB
testcase_11 AC 76 ms
61,060 KB
testcase_12 AC 313 ms
69,660 KB
testcase_13 AC 324 ms
69,760 KB
testcase_14 AC 327 ms
69,852 KB
testcase_15 AC 321 ms
70,400 KB
testcase_16 AC 315 ms
70,772 KB
testcase_17 AC 1,004 ms
76,216 KB
testcase_18 AC 1,409 ms
76,232 KB
testcase_19 AC 377 ms
71,016 KB
testcase_20 AC 2,626 ms
76,644 KB
testcase_21 AC 2,740 ms
76,700 KB
testcase_22 AC 3,083 ms
76,300 KB
testcase_23 AC 2,602 ms
76,508 KB
testcase_24 AC 2,620 ms
76,292 KB
testcase_25 AC 2,613 ms
76,268 KB
testcase_26 AC 2,647 ms
76,452 KB
testcase_27 AC 37 ms
52,416 KB
testcase_28 TLE -
testcase_29 AC 3,206 ms
76,608 KB
testcase_30 AC 3,187 ms
76,112 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

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)[1:]

    K=0
    for a in D:
        if a==2:
            K+=(X==Y)
        else:
            p=a-1
            B=(p*X-Y)
            C=(-X+p*Y)
            if B>0 and C>0 and B%(p*p-1)==C%(p*p-1)==0:
                K+=1
    L[i]=K

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