結果

問題 No.1140 EXPotentiaLLL!
ユーザー rin204rin204
提出日時 2020-08-13 06:57:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 116,460 KB
最終ジャッジ日時 2024-04-18 01:13:13
合計ジャッジ時間 8,381 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 461 ms
116,088 KB
testcase_01 WA -
testcase_02 AC 457 ms
116,368 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 280 ms
114,892 KB
testcase_09 AC 260 ms
114,920 KB
testcase_10 AC 270 ms
114,740 KB
testcase_11 AC 272 ms
114,720 KB
testcase_12 AC 279 ms
115,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

prime = [True for _ in range(5 * 10 ** 6 + 1)]
prime[0] = prime[1] = False
for i in range(2, 5 * 10 ** 6 + 1):
    if not prime[i]:
        continue
    for j in range(2 * i, 10 ** 6 + 1, i):
        prime[j] = False

t = int(input())
for _ in range(t):
    a, p = map(int, input().split())
    if prime[p]:
        if a % p == 0:
            print(0)
        else:
            print(1)
    else:
        print(-1)
0