結果

問題 No.1140 EXPotentiaLLL!
ユーザー DrDrpilotDrDrpilot
提出日時 2022-03-03 15:59:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 434 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 87,220 KB
最終ジャッジ日時 2023-09-24 11:26:52
合計ジャッジ時間 9,243 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def isprime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0: return False
    return True
t=int(input())
for _ in range(t):
    a,p=map(int,input().split())
    if isprime(p)==False:
        print(-1)
    else:
        if a%p==0:
            print(0)
        else:
            print(1)
0