結果

問題 No.1140 EXPotentiaLLL!
ユーザー ああいいああいい
提出日時 2021-12-23 22:47:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,735 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 81,560 KB
実行使用メモリ 169,620 KB
最終ジャッジ日時 2023-10-18 22:21:50
合計ジャッジ時間 18,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,645 ms
169,620 KB
testcase_01 AC 1,590 ms
169,620 KB
testcase_02 AC 1,575 ms
169,620 KB
testcase_03 AC 1,414 ms
169,620 KB
testcase_04 AC 1,165 ms
169,620 KB
testcase_05 AC 1,654 ms
169,620 KB
testcase_06 AC 1,569 ms
169,620 KB
testcase_07 AC 1,735 ms
169,620 KB
testcase_08 AC 398 ms
155,760 KB
testcase_09 AC 391 ms
155,760 KB
testcase_10 AC 397 ms
155,760 KB
testcase_11 AC 402 ms
157,808 KB
testcase_12 AC 400 ms
155,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

C = 5 * 10 ** 6
dat = [0] * C
prime = set()
prime.add(2)
for i in range(4,C,2):
    dat[i] = 1
i = 3
while i < C:
    if dat[i] == 0:
        prime.add(i)
        j = 2 * i
        while j < C:
            dat[j] = 1
            j += i
    i += 2
for _ in range(T):
    a,p = map(int,input().split())
    if p in prime:
        if a % p == 0:print(0)
        else:print(1)
    else:
        print(-1)
0