結果
| 問題 | No.8056 量子コンピュータで素因数分解 Easy |
| ユーザー |
tatyam
|
| 提出日時 | 2020-02-04 18:19:53 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 107 ms / 2,000 ms |
| + 1µs | |
| コード長 | 379 bytes |
| 記録 | |
| コンパイル時間 | 58 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 11,392 KB |
| 平均クエリ数 | 2.15 |
| 最終ジャッジ日時 | 2026-10-10 00:47:38 |
| 合計ジャッジ時間 | 3,257 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
ソースコード
from random import randint
from sys import exit
from math import gcd
def answer(p):
print('!', p, n // p)
exit(0)
n = int(input())
while True:
x = randint(2, n - 2)
if gcd(n, x) > 1:
answer(gcd(n, x))
print('?', x, flush = True)
r = int(input())
if r % 2 == 0:
p = pow(x, r // 2, n) + 1
if p != n:
answer(gcd(n, p))
tatyam