結果

問題 No.1140 EXPotentiaLLL!
ユーザー tyawanmusityawanmusi
提出日時 2020-07-31 23:57:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 613 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 118,424 KB
最終ジャッジ日時 2023-09-21 03:42:34
合計ジャッジ時間 9,127 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 583 ms
118,424 KB
testcase_01 AC 577 ms
117,592 KB
testcase_02 AC 559 ms
117,840 KB
testcase_03 AC 542 ms
117,352 KB
testcase_04 AC 494 ms
116,904 KB
testcase_05 AC 579 ms
117,304 KB
testcase_06 AC 577 ms
117,308 KB
testcase_07 AC 613 ms
118,040 KB
testcase_08 AC 345 ms
115,880 KB
testcase_09 AC 342 ms
116,032 KB
testcase_10 AC 344 ms
115,768 KB
testcase_11 AC 346 ms
115,884 KB
testcase_12 AC 345 ms
115,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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