結果

問題 No.1140 EXPotentiaLLL!
ユーザー first_vilfirst_vil
提出日時 2020-12-08 13:02:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 695 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 81,876 KB
実行使用メモリ 138,856 KB
最終ジャッジ日時 2023-10-17 17:10:09
合計ジャッジ時間 10,233 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 671 ms
138,856 KB
testcase_01 AC 665 ms
138,856 KB
testcase_02 AC 646 ms
138,856 KB
testcase_03 AC 615 ms
138,856 KB
testcase_04 AC 586 ms
138,856 KB
testcase_05 AC 667 ms
138,856 KB
testcase_06 AC 671 ms
138,856 KB
testcase_07 AC 695 ms
138,856 KB
testcase_08 AC 382 ms
137,792 KB
testcase_09 AC 383 ms
137,808 KB
testcase_10 AC 376 ms
137,824 KB
testcase_11 AC 444 ms
138,856 KB
testcase_12 AC 394 ms
137,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.readline

    p=[True]*5000001
    p[0]=p[1]=False
    i=2
    ps=[]
    while i<5000000:
        if p[i]:
            ps.append(i)
            j=i<<1
            while j<=5000000:
                p[j]=False
                j+=i
        i+=1
    
    for _ in range(int(input())):
        a,b=map(int,input().split())
        if p[b]:
            print(1 if a%b else 0)
        else:
            print(-1)
if __name__=='__main__':
    main()
0