結果
| 問題 | No.8056 量子コンピュータで素因数分解 Easy |
| ユーザー |
chocorusk
|
| 提出日時 | 2020-02-05 03:00:11 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 107 ms / 2,000 ms |
| + 1µs | |
| コード長 | 402 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,848 KB |
| 実行使用メモリ | 11,264 KB |
| 平均クエリ数 | 2.19 |
| 最終ジャッジ日時 | 2026-10-10 00:48:47 |
| 合計ジャッジ時間 | 3,159 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
ソースコード
import sys
from random import randint
from math import gcd
n=int(input())
while True:
a=randint(2, n-1)
g=gcd(a, n)
if g!=1:
print("! %d %d" % (g, n//g))
sys.stdout.flush()
break
print("? %d" % a)
sys.stdout.flush()
r=int(input())
if r%2==1:
continue
x=pow(a, r//2, n)
if x==n-1:
continue
p=gcd(x+1, n)
print("! %d %d" % (p, n//p))
sys.stdout.flush()
break
chocorusk