結果

問題 No.1140 EXPotentiaLLL!
ユーザー raven7959raven7959
提出日時 2021-10-15 18:20:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 688 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 81,384 KB
実行使用メモリ 116,712 KB
最終ジャッジ日時 2023-10-17 19:37:00
合計ジャッジ時間 9,646 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 680 ms
116,420 KB
testcase_01 AC 660 ms
115,880 KB
testcase_02 AC 640 ms
116,712 KB
testcase_03 AC 610 ms
115,680 KB
testcase_04 AC 566 ms
115,356 KB
testcase_05 AC 652 ms
115,800 KB
testcase_06 AC 636 ms
115,720 KB
testcase_07 AC 688 ms
116,356 KB
testcase_08 AC 347 ms
112,880 KB
testcase_09 AC 357 ms
112,916 KB
testcase_10 AC 351 ms
112,908 KB
testcase_11 AC 340 ms
112,960 KB
testcase_12 AC 344 ms
112,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=5*10**6
isprime=[True]*(N+1) #isprime[i]はiが素数かどうか
isprime[0]=False
isprime[1]=False
for p in range(2,N+1):
  if isprime[p]:
    for q in range(2*p,N+1,p):
      isprime[q]=False

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