結果

問題 No.8093 Please GCD
ユーザー ikoma
提出日時 2022-04-01 22:48:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 515 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 93,276 KB
平均クエリ数 0.03
最終ジャッジ日時 2024-11-20 11:07:38
合計ジャッジ時間 92,730 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 TLE * 29
権限があれば一括ダウンロードができます

ソースコード

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