結果

問題 No.1140 EXPotentiaLLL!
ユーザー pluto77pluto77
提出日時 2022-06-14 14:16:35
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 343 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 73,088 KB
最終ジャッジ日時 2024-04-10 07:47:30
合計ジャッジ時間 3,207 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 62 ms
64,768 KB
testcase_09 AC 61 ms
64,768 KB
testcase_10 AC 61 ms
64,768 KB
testcase_11 AC 61 ms
64,896 KB
testcase_12 AC 58 ms
64,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1140
T=int(input())
limit = 5000000
is_prime=[True]*500001
is_prime[0]=is_prime[1]=False

for p in range(0,500001):
 if not is_prime[p]:
  continue
 for i in range(p*p,500001,p):
  is_prime[i]=False


for i in range(T):
 A,P = map(int, input().split())
 if is_prime[P]:
  if A % P == 0:
   print(0)
  else:
   print(1)
 else:
  print(-1)
0