結果

問題 No.3093 Please GCD
ユーザー ikomaikoma
提出日時 2022-04-01 23:06:58
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 541 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 87,076 KB
平均クエリ数 308.93
最終ジャッジ日時 2024-04-30 15:41:56
合計ジャッジ時間 8,802 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
70,220 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 115 ms
81,580 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 117 ms
80,260 KB
testcase_09 RE -
testcase_10 AC 60 ms
68,816 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 WA -
testcase_18 AC 113 ms
81,288 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 WA -
testcase_22 RE -
testcase_23 AC 116 ms
81,780 KB
testcase_24 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 WA -
testcase_28 RE -
testcase_29 AC 127 ms
81,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def eratosthenes(n):
    res=[0]*(n+1)
    prime=set([])
    for i in range(2,n+1):
        if not res[i]:
            prime.add(i)
            for j in range(i,n+1,i):
                res[j]=1
    return sorted(list(prime))
N=int(input())
prime = eratosthenes(N)
ans = 1
cnt=0
for p in prime:
    y=1
    while cnt<600:
        cnt+=1
        y*=p
        print(f"? {y}", flush=True)
        s=int(input())
        if s<=1:break
        if s==y:continue
        ans *= y//p
        break
    if cnt>=600:break
print(f"! {ans}", flush=True)
0