結果
| 問題 |
No.1140 EXPotentiaLLL!
|
| ユーザー |
|
| 提出日時 | 2021-09-18 11:26:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,600 ms / 2,000 ms |
| コード長 | 515 bytes |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 82,296 KB |
| 実行使用メモリ | 116,580 KB |
| 最終ジャッジ日時 | 2024-06-30 08:38:06 |
| 合計ジャッジ時間 | 17,101 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 |
ソースコード
#!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
def eratosthenes(n):
a = [True] * n
a[0] = False
a[1] = False
for i in range(2, n):
if not a[i]:
continue
for j in range(2, (n - 1) // i + 1):
a[i * j] = False
return a
t = int(input())
pr = eratosthenes(5000001)
for _ in range(t):
a, p = map(int, input().split())
if pr[p]:
print(0 if a % p == 0 else 1)
else:
print(-1)