結果
| 問題 |
No.1140 EXPotentiaLLL!
|
| コンテスト | |
| ユーザー |
paruf4
|
| 提出日時 | 2020-07-31 23:16:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 374 bytes |
| コンパイル時間 | 280 ms |
| コンパイル使用メモリ | 82,540 KB |
| 実行使用メモリ | 91,348 KB |
| 最終ジャッジ日時 | 2024-07-06 21:25:07 |
| 合計ジャッジ時間 | 7,776 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | TLE * 1 -- * 11 |
ソースコード
def isPrime(x):
if x < 2:
return False
for i in range(2, int(x**0.5)+1):
if x % i == 0:
return False
return True
t = int(input())
for i in range(t):
a,p = map(int,input().split())
if isPrime(p):
if ((p-1)//2)%2==1:
print(pow(a,0,p))
else:
print(pow(a,1,p))
else:
print(-1)
paruf4