結果

問題 No.1140 EXPotentiaLLL!
ユーザー googol_S0
提出日時 2020-08-01 00:27:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 611 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 189,752 KB
最終ジャッジ日時 2024-07-06 22:49:36
合計ジャッジ時間 8,367 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
S=sys.stdin.readlines()
T=int(S[0])
A,P=0,0
PR=[1]*6000000
PR[0]=0
PR[1]=0
for i in range(2,6000000):
  if PR[i]:
    for j in range(i*2,6000000,i):
      PR[j]=0
for i in range(T):
  A,P=map(int,S[i+1].split())
  if PR[P] and A%P:
    print(1)
  elif PR[P]:
    print(0)
  else:
    print(-1)
0