結果

問題 No.1140 EXPotentiaLLL!
ユーザー mlihua09mlihua09
提出日時 2020-09-17 02:36:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 534 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 86,604 KB
実行使用メモリ 155,956 KB
最終ジャッジ日時 2023-09-04 04:24:25
合計ジャッジ時間 7,937 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 510 ms
155,828 KB
testcase_01 AC 516 ms
155,956 KB
testcase_02 AC 503 ms
155,648 KB
testcase_03 AC 459 ms
155,640 KB
testcase_04 AC 416 ms
155,548 KB
testcase_05 AC 506 ms
155,884 KB
testcase_06 AC 501 ms
155,660 KB
testcase_07 AC 534 ms
155,372 KB
testcase_08 AC 272 ms
155,716 KB
testcase_09 AC 273 ms
154,100 KB
testcase_10 AC 274 ms
154,868 KB
testcase_11 AC 266 ms
154,496 KB
testcase_12 AC 273 ms
153,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


P = [0] + [0] + [1] * (5 * 10 ** 6 - 1)

for i in range(2, 2500):
    
    if P[i]:
        
        for j in range(2 * i, 5 * 10 ** 6 + 1, i):
            
            P[j] = 0
            
import sys 
for _ in range(int(input())):
    
    a, p = map(int, sys.stdin.readline().split())
    
    if P[p]:
        
        if a % p:
            print(1)
            
        else:
            print(0)
            
    else:
        print(-1)
0