結果
問題 |
No.8056 量子コンピュータで素因数分解 Easy
|
ユーザー |
![]() |
提出日時 | 2020-02-05 02:59:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 407 bytes |
コンパイル時間 | 265 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 28,248 KB |
平均クエリ数 | 1.46 |
最終ジャッジ日時 | 2024-12-31 19:24:27 |
合計ジャッジ時間 | 4,965 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 RE * 24 |
ソースコード
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=math.gcd(x+1, n) print("! %d %d" % (p, n//p)) sys.stdout.flush() break