結果

問題 No.1140 EXPotentiaLLL!
ユーザー butamanbutaman
提出日時 2020-12-14 15:40:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 116,204 KB
最終ジャッジ日時 2023-10-20 05:02:24
合計ジャッジ時間 8,550 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 559 ms
116,152 KB
testcase_01 AC 520 ms
115,704 KB
testcase_02 AC 529 ms
116,164 KB
testcase_03 AC 478 ms
115,524 KB
testcase_04 AC 459 ms
115,392 KB
testcase_05 AC 508 ms
115,708 KB
testcase_06 WA -
testcase_07 AC 537 ms
116,204 KB
testcase_08 AC 318 ms
113,168 KB
testcase_09 AC 299 ms
113,184 KB
testcase_10 AC 322 ms
113,200 KB
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys


def input():
   return sys.stdin.buffer.readline()[:-1]

MAXX = 5*10**6 + 5

isprime = [1]*MAXX
#theratos
for num in range(2, MAXX):
    if isprime[num]:
        for k in range(num*2, MAXX, num):
            isprime[k] = 0

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

0