結果

問題 No.8093 Please GCD
ユーザー ikoma
提出日時 2022-04-01 23:03:43
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 515 bytes
コンパイル時間 858 ms
コンパイル使用メモリ 81,972 KB
実行使用メモリ 94,260 KB
平均クエリ数 641.83
最終ジャッジ日時 2024-11-20 11:43:47
合計ジャッジ時間 10,351 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 7 RE * 13
権限があれば一括ダウンロードができます

ソースコード

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 True:
        cnt+=1
        y*=p
        print(f"? {y}", flush=True)
        s=int(input())
        if s==1:break
        if s==y:continue
        ans *= y//p
        break
print(f"! {ans}", flush=True)
0