結果

問題 No.1140 EXPotentiaLLL!
ユーザー zkouzkou
提出日時 2020-07-31 21:34:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 613 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 117,492 KB
最終ジャッジ日時 2023-09-20 22:04:42
合計ジャッジ時間 10,123 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 588 ms
117,488 KB
testcase_01 AC 601 ms
117,264 KB
testcase_02 AC 578 ms
117,492 KB
testcase_03 AC 565 ms
116,824 KB
testcase_04 AC 527 ms
116,744 KB
testcase_05 AC 600 ms
116,740 KB
testcase_06 AC 574 ms
116,736 KB
testcase_07 AC 613 ms
117,408 KB
testcase_08 AC 406 ms
116,088 KB
testcase_09 AC 407 ms
116,188 KB
testcase_10 AC 416 ms
115,828 KB
testcase_11 AC 409 ms
116,004 KB
testcase_12 AC 403 ms
116,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

table_len = 5000005
table = [True] * table_len
table[0] = False
table[1] = False
for i in range(2, table_len):
    if table[i]:
        for j in range(2*i, table_len, i):
            table[j] = False

T = int(input())
for _ in range(T):
    A, P = map(int, input().split())
    if table[P]:
        print(1 if A % P else 0)
    else:
        print(-1)
0