結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | koba-e964 |
提出日時 | 2021-09-18 11:32:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,487 ms / 2,000 ms |
コード長 | 553 bytes |
コンパイル時間 | 1,612 ms |
コンパイル使用メモリ | 86,900 KB |
実行使用メモリ | 117,684 KB |
最終ジャッジ日時 | 2023-09-12 21:13:01 |
合計ジャッジ時間 | 17,117 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,447 ms
117,684 KB |
testcase_01 | AC | 1,435 ms
117,516 KB |
testcase_02 | AC | 1,433 ms
117,560 KB |
testcase_03 | AC | 1,241 ms
117,520 KB |
testcase_04 | AC | 1,018 ms
117,468 KB |
testcase_05 | AC | 1,432 ms
117,660 KB |
testcase_06 | AC | 1,380 ms
117,404 KB |
testcase_07 | AC | 1,487 ms
117,348 KB |
testcase_08 | AC | 279 ms
114,468 KB |
testcase_09 | AC | 240 ms
114,320 KB |
testcase_10 | AC | 241 ms
114,020 KB |
testcase_11 | AC | 245 ms
114,012 KB |
testcase_12 | AC | 241 ms
114,368 KB |
ソースコード
#!/usr/bin/env python3 import sys import math 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, math.ceil(math.sqrt(n - 1))): 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(5000001) for _ in range(t): a, p = map(int, input().split()) if pr[p]: print(0 if a % p == 0 else 1) else: print(-1)