結果
問題 |
No.1140 EXPotentiaLLL!
|
ユーザー |
![]() |
提出日時 | 2023-08-14 16:01:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,454 ms / 2,000 ms |
コード長 | 537 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 115,840 KB |
最終ジャッジ日時 | 2024-11-22 14:31:54 |
合計ジャッジ時間 | 15,586 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 |
ソースコード
import math def sieve_of_eratosthenes(n): prime = [True for i in range(n+1)] prime[0] = False prime[1] = False sqrt_n = math.ceil(math.sqrt(n)) for i in range(2, sqrt_n): if prime[i]: for j in range(2*i, n+1, i): prime[j] = False return prime P = sieve_of_eratosthenes(5*10**6) T = int(input()) for t in range(T): a,p = map(int,input().split()) if P[p]: if a % p == 0: print(0) else: print(1) else: print(-1)