結果
| 問題 | No.8056 量子コンピュータで素因数分解 Easy |
| ユーザー |
emthrm
|
| 提出日時 | 2020-02-05 04:32:05 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 411 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,848 KB |
| 実行使用メモリ | 13,824 KB |
| 平均クエリ数 | 1.12 |
| 最終ジャッジ日時 | 2026-10-10 00:50:11 |
| 合計ジャッジ時間 | 4,333 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 26 |
ソースコード
import math
import random
n = int(input())
while True:
a = random.randint(2, n - 1)
g = math.gcd(a, n)
if g > 1:
print('! %d %d' % (g, n / g), flush = True)
break
print('? %d' % a, flush = True)
r = int(input())
if r % 2 == 1:
continue
p = math.gcd(pow(a, r / 2) + 1, n)
q = math.gcd(pow(a, r / 2) - 1, n)
if p < n and q < n:
print('! %d %d' % (p, q), flush = True)
break
emthrm