結果
問題 |
No.1140 EXPotentiaLLL!
|
ユーザー |
|
提出日時 | 2022-05-29 14:04:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 675 ms / 2,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 82,556 KB |
実行使用メモリ | 117,040 KB |
最終ジャッジ日時 | 2024-09-20 23:56:07 |
合計ジャッジ時間 | 10,091 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 |
ソースコード
import sys input = sys.stdin.readline IsPrime = [True for _ in range(5 * 10**6 + 1)] IsPrime[0] = IsPrime[1] = False for i in range(2, 5 * 10**6 + 1): if IsPrime[i]: for j in range(i + i, 5 * 10**6 + 1, i): IsPrime[j] = False t = int(input()) for _ in range(t): a, p = map(int, input().split()) if IsPrime[p]: if a % p == 0: print(0) else: print(1) else: print(-1)