結果

問題 No.1140 EXPotentiaLLL!
ユーザー koba-e964koba-e964
提出日時 2021-09-18 11:26:34
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 514 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 83,644 KB
最終ジャッジ日時 2023-09-12 21:03:47
合計ジャッジ時間 4,720 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 96 ms
80,120 KB
testcase_09 AC 97 ms
79,856 KB
testcase_10 AC 98 ms
79,932 KB
testcase_11 AC 97 ms
79,980 KB
testcase_12 AC 99 ms
80,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

def eratosthenes(n):
    a = [True] * n
    a[0] = False
    a[1] = False
    for i in range(2, n):
        if not a[i]:
            continue
        for j in range(2, (n - 1) // i + 1):
            a[i * j] = False
    return a


t = int(input())
pr = eratosthenes(500001)
for _ in range(t):
    a, p = map(int, input().split())
    if pr[p]:
        print(0 if a % p == 0 else 1)
    else:
        print(-1)
0