結果

問題 No.1140 EXPotentiaLLL!
ユーザー ああいいああいい
提出日時 2021-12-23 22:45:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,708 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 81,436 KB
実行使用メモリ 170,032 KB
最終ジャッジ日時 2023-10-18 22:19:46
合計ジャッジ時間 17,902 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,622 ms
169,888 KB
testcase_01 AC 1,564 ms
169,888 KB
testcase_02 AC 1,560 ms
170,032 KB
testcase_03 AC 1,396 ms
170,032 KB
testcase_04 AC 1,165 ms
170,032 KB
testcase_05 AC 1,616 ms
169,888 KB
testcase_06 AC 1,571 ms
169,884 KB
testcase_07 AC 1,708 ms
169,888 KB
testcase_08 AC 397 ms
155,648 KB
testcase_09 AC 394 ms
155,648 KB
testcase_10 AC 399 ms
155,648 KB
testcase_11 AC 403 ms
155,648 KB
testcase_12 AC 397 ms
155,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

C = 5 * 10 ** 6
dat = [0] * C
prime = set()
i = 2
while i < C:
    if dat[i] == 0:
        prime.add(i)
        j = 2 * i
        while j < C:
            dat[j] = 1
            j += i
    i += 1
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