結果

問題 No.1140 EXPotentiaLLL!
ユーザー Chihaya_chanChihaya_chan
提出日時 2020-08-10 02:11:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 968 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 159,616 KB
最終ジャッジ日時 2024-04-15 20:27:49
合計ジャッジ時間 11,984 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 929 ms
159,360 KB
testcase_01 AC 968 ms
159,616 KB
testcase_02 AC 933 ms
159,488 KB
testcase_03 AC 814 ms
150,912 KB
testcase_04 AC 719 ms
142,080 KB
testcase_05 AC 880 ms
158,720 KB
testcase_06 AC 865 ms
156,544 KB
testcase_07 AC 946 ms
159,616 KB
testcase_08 AC 410 ms
114,688 KB
testcase_09 AC 410 ms
114,432 KB
testcase_10 AC 398 ms
114,560 KB
testcase_11 AC 391 ms
114,944 KB
testcase_12 AC 396 ms
115,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

is_Prime = [True for i in range(5*10**6+1)]

is_Prime[0] = is_Prime[1] = False
for i in range(2, 5*10**6+1):
    if is_Prime[i] == False:
        continue
    for j in range(2, 5*10**6+1):
        if i*j > 5*10**6:
            break
        is_Prime[i*j] = False

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