結果
| 問題 |
No.8114 Prime Checker+1
|
| ユーザー |
|
| 提出日時 | 2025-02-21 20:22:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 637 bytes |
| コンパイル時間 | 436 ms |
| コンパイル使用メモリ | 82,896 KB |
| 実行使用メモリ | 159,080 KB |
| 最終ジャッジ日時 | 2025-02-21 20:22:29 |
| 合計ジャッジ時間 | 7,308 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 1 -- * 26 |
ソースコード
import time
from random import randrange
import sys
sys.set_int_max_str_digits(0)
start = time.time()
num = int(input())
print(0)
if num < 4:
print("Yes")
exit()
if not num&1:
print("No")
exit()
d, s = num-1, 0
while not d&1:
d >>= 1
s += 1
while time.time() - start < 1.5:
test = randrange(2, 1<<64)
t = pow(test, d, num)
if 1 < t < num-1:
for _ in range(s-1):
t = t*t%num
if t == num-1: break
if time.time() - start > 1.8:
print("Yes")
exit()
else:
print("No")
exit()
print("Yes")
exit()