結果
| 問題 |
No.8056 量子コンピュータで素因数分解 Easy
|
| ユーザー |
|
| 提出日時 | 2022-10-19 02:18:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 413 bytes |
| コンパイル時間 | 130 ms |
| コンパイル使用メモリ | 82,292 KB |
| 実行使用メモリ | 84,300 KB |
| 平均クエリ数 | 1.00 |
| 最終ジャッジ日時 | 2024-06-29 07:40:42 |
| 合計ジャッジ時間 | 4,225 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 26 |
ソースコード
import math
n = int(input())
for a in range[2, 1000]:
g = math.gcd(a, n)
if g > 1:
print("!", g, n // g)
exit(0)
print("?", a)
r = int(input())
if r % 2 == 1:
continue
pow_a = pow(a, r // 2, mod=n)
if pow_a == n - 1:
continue
p = math.gcd(pow_a + 1, n)
q = math.gcd(pow_a - 1, n)
if p * q == n:
print("!", p, q)
break