結果

問題 No.1140 EXPotentiaLLL!
ユーザー dangodango
提出日時 2023-06-18 21:44:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 562 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 118,044 KB
最終ジャッジ日時 2023-09-08 15:55:43
合計ジャッジ時間 10,665 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 507 ms
117,872 KB
testcase_01 AC 539 ms
117,392 KB
testcase_02 AC 518 ms
117,812 KB
testcase_03 AC 482 ms
116,784 KB
testcase_04 AC 442 ms
116,876 KB
testcase_05 AC 528 ms
117,232 KB
testcase_06 AC 505 ms
117,260 KB
testcase_07 AC 562 ms
118,044 KB
testcase_08 AC 290 ms
115,800 KB
testcase_09 AC 300 ms
115,648 KB
testcase_10 AC 293 ms
115,628 KB
testcase_11 AC 282 ms
115,700 KB
testcase_12 AC 311 ms
115,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
prime = [1] * 5000001
prime[0] = prime[1] = 0
for i in range(2, 5000001):
  if prime[i]:
    for j in range(2 * i, 5000001, i): prime[j] = 0
for _ in range(int(sys.stdin.readline())):
  A, P = map(int, sys.stdin.readline().split())
  if prime[P]:
    if A % P: print(1)
    else: print(0)
  else: print(-1)
0