結果

問題 No.1140 EXPotentiaLLL!
ユーザー chineristACchineristAC
提出日時 2020-10-01 10:03:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 635 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 151,888 KB
最終ジャッジ日時 2023-09-21 06:46:31
合計ジャッジ時間 9,128 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 564 ms
151,400 KB
testcase_01 AC 556 ms
151,164 KB
testcase_02 AC 552 ms
151,888 KB
testcase_03 AC 521 ms
151,168 KB
testcase_04 AC 491 ms
150,948 KB
testcase_05 AC 575 ms
150,820 KB
testcase_06 AC 548 ms
150,900 KB
testcase_07 AC 635 ms
151,128 KB
testcase_08 AC 367 ms
150,912 KB
testcase_09 AC 362 ms
151,092 KB
testcase_10 AC 366 ms
150,836 KB
testcase_11 AC 360 ms
150,712 KB
testcase_12 AC 362 ms
151,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

prime=set([])

def factorization(n):
    res=[0 for i in range(n+1)]
    for i in range(2,n+1):
        if not res[i]:
            prime.add(i)
            for j in range(1,(n)//i+1):
                res[i*j]+=1

factorization(5*10**6)

import sys

input=sys.stdin.buffer.readline
for _ in range(int(input())):
    a,p=map(int,input().split())
    if p in prime:
        if a%p==0:
            print(0)
        else:
            print(1)
    else:
        print(-1)
s = input()
0