結果
| 問題 | No.8056 量子コンピュータで素因数分解 Easy |
| ユーザー |
|
| 提出日時 | 2020-01-28 01:13:10 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 379 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 13,952 KB |
| 平均クエリ数 | 1.12 |
| 最終ジャッジ日時 | 2026-10-10 00:47:16 |
| 合計ジャッジ時間 | 4,494 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 RE * 25 |
ソースコード
import random
import math
n = int(input())
while True:
a = random.randint(2, n - 2)
b = math.gcd(n, a)
if b != 1:
print("!", b, n // b, flush=True)
break
print("?", a, flush=True)
r = int(input())
if r % 2 == 1:
continue
x = math.pow(a, r // 2, n)
if x == n - 1:
continue
p = math.gcd(n, x + 1)
print("!", p, n // p, flush=True)
break