結果

問題 No.1140 EXPotentiaLLL!
ユーザー syunsukesyunsuke
提出日時 2020-09-16 22:26:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 634 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 86,284 KB
実行使用メモリ 117,748 KB
最終ジャッジ日時 2023-09-04 04:06:08
合計ジャッジ時間 9,582 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 597 ms
117,656 KB
testcase_01 AC 602 ms
117,196 KB
testcase_02 AC 582 ms
117,448 KB
testcase_03 AC 558 ms
116,460 KB
testcase_04 AC 518 ms
116,356 KB
testcase_05 AC 593 ms
116,688 KB
testcase_06 AC 601 ms
117,052 KB
testcase_07 AC 634 ms
117,748 KB
testcase_08 AC 359 ms
115,500 KB
testcase_09 AC 366 ms
115,184 KB
testcase_10 AC 368 ms
115,280 KB
testcase_11 AC 363 ms
115,404 KB
testcase_12 AC 364 ms
115,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P=[0 for i in range(5*(10**6)+1)]
P[0]=1
P[1]=1
#print(len(P))
for i in range(2,len(P)):
    if P[i]==0:
        for j in range(2,len(P)):
            if i*j>5*(10**6):
                break
            else:
                P[i*j]=1
#print(P[:20])
import sys
input=sys.stdin.readline
Q=int(input())
for q in range(Q):
    A,T=map(int,input().split())
    if P[T]==0:
        if A%T==0:
            print(0)
        else:
            print(1)
    else:
        print(-1)
            
0