結果

問題 No.1140 EXPotentiaLLL!
ユーザー chineristACchineristAC
提出日時 2020-07-31 22:40:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 614 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 151,556 KB
最終ジャッジ日時 2023-09-21 01:14:00
合計ジャッジ時間 9,102 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 575 ms
151,316 KB
testcase_01 AC 575 ms
151,044 KB
testcase_02 AC 541 ms
151,552 KB
testcase_03 AC 526 ms
150,888 KB
testcase_04 AC 480 ms
151,328 KB
testcase_05 AC 556 ms
151,556 KB
testcase_06 AC 549 ms
151,224 KB
testcase_07 AC 614 ms
151,308 KB
testcase_08 AC 354 ms
151,476 KB
testcase_09 AC 355 ms
150,880 KB
testcase_10 AC 362 ms
151,280 KB
testcase_11 AC 356 ms
150,976 KB
testcase_12 AC 356 ms
151,116 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)
0