結果

問題 No.1140 EXPotentiaLLL!
ユーザー mlihua09mlihua09
提出日時 2020-09-17 02:35:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,481 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 157,524 KB
最終ジャッジ日時 2023-09-04 04:24:11
合計ジャッジ時間 15,636 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,378 ms
156,984 KB
testcase_01 AC 1,432 ms
156,916 KB
testcase_02 AC 1,394 ms
156,872 KB
testcase_03 AC 1,198 ms
156,904 KB
testcase_04 AC 981 ms
157,524 KB
testcase_05 AC 1,368 ms
156,640 KB
testcase_06 AC 1,327 ms
156,300 KB
testcase_07 AC 1,481 ms
156,296 KB
testcase_08 AC 278 ms
154,176 KB
testcase_09 AC 266 ms
154,904 KB
testcase_10 AC 270 ms
154,488 KB
testcase_11 AC 268 ms
155,060 KB
testcase_12 AC 275 ms
154,208 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
            
for _ in range(int(input())):
    
    a, p = map(int, input().split())
    
    if P[p]:
        
        if a % p:
            print(1)
            
        else:
            print(0)
            
    else:
        print(-1)
0