結果

問題 No.3056 量子コンピュータで素因数分解 Easy
ユーザー 👑 MizarMizar
提出日時 2022-09-27 01:11:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 183 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 25,068 KB
平均クエリ数 2.65
最終ジャッジ日時 2023-08-30 06:59:32
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
24,692 KB
testcase_01 AC 65 ms
24,720 KB
testcase_02 AC 110 ms
24,808 KB
testcase_03 AC 109 ms
24,480 KB
testcase_04 AC 64 ms
24,576 KB
testcase_05 AC 62 ms
24,696 KB
testcase_06 AC 64 ms
24,468 KB
testcase_07 AC 61 ms
24,948 KB
testcase_08 AC 66 ms
24,804 KB
testcase_09 AC 66 ms
24,572 KB
testcase_10 AC 66 ms
24,944 KB
testcase_11 AC 73 ms
24,936 KB
testcase_12 AC 101 ms
24,452 KB
testcase_13 AC 66 ms
24,496 KB
testcase_14 AC 82 ms
24,596 KB
testcase_15 AC 102 ms
24,464 KB
testcase_16 AC 74 ms
24,980 KB
testcase_17 AC 78 ms
24,912 KB
testcase_18 AC 79 ms
24,280 KB
testcase_19 AC 149 ms
24,556 KB
testcase_20 AC 100 ms
24,348 KB
testcase_21 AC 77 ms
24,960 KB
testcase_22 AC 89 ms
24,464 KB
testcase_23 AC 86 ms
24,548 KB
testcase_24 AC 81 ms
24,684 KB
testcase_25 AC 58 ms
25,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math;import random;G=math.gcd;a=g=2;n=int(input())
while g<3:print("?",a);t=pow(a,int(input())//2,n);a=random.randrange(2,n);g=max(G(n,t-1),G(n,t+1)%n,G(n,a))
print("!",g,n//g)
0