結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | butaman |
提出日時 | 2020-12-14 22:18:50 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 515 bytes |
コンパイル時間 | 579 ms |
コンパイル使用メモリ | 11,844 KB |
実行使用メモリ | 58,148 KB |
最終ジャッジ日時 | 2023-10-20 05:15:26 |
合計ジャッジ時間 | 7,620 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
ソースコード
import math import sys def input(): return sys.stdin.buffer.readline()[:-1] MAXX = 5*10**6 + 5 isprime = [1]*MAXX isprime[0] = isprime[1] = 0 #theratos for num in range(2, MAXX): if isprime[num]: for k in range(num*2, MAXX, num): isprime[k] = 0 T = int(input()) for tt in range(T): A, P = map(int, input().split()) if isprime[P]: if A % P == 0: print(0) else: #ferma A^(P-1) mod P = 1 print(1) else: print(-1)