結果

問題 No.3093 Please GCD
ユーザー PNJPNJ
提出日時 2023-11-25 03:10:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 627 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 92,404 KB
平均クエリ数 1003.70
最終ジャッジ日時 2023-11-25 03:10:14
合計ジャッジ時間 8,692 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
69,460 KB
testcase_01 AC 61 ms
69,460 KB
testcase_02 AC 73 ms
75,128 KB
testcase_03 AC 228 ms
92,404 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 213 ms
92,404 KB
testcase_07 AC 180 ms
92,404 KB
testcase_08 AC 199 ms
92,404 KB
testcase_09 AC 178 ms
92,404 KB
testcase_10 AC 55 ms
69,460 KB
testcase_11 AC 95 ms
79,644 KB
testcase_12 AC 165 ms
90,100 KB
testcase_13 AC 174 ms
92,404 KB
testcase_14 AC 215 ms
92,404 KB
testcase_15 AC 68 ms
75,128 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 203 ms
92,404 KB
testcase_19 AC 188 ms
92,404 KB
testcase_20 AC 230 ms
92,404 KB
testcase_21 AC 175 ms
92,404 KB
testcase_22 AC 182 ms
92,404 KB
testcase_23 WA -
testcase_24 AC 177 ms
92,404 KB
testcase_25 WA -
testcase_26 AC 175 ms
92,404 KB
testcase_27 AC 193 ms
92,404 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def Eratosthenes(N):
  is_prime = [1 for i in range(N+1)]
  is_prime[0] = is_prime[1] = 0
  P = []
  for p in range(2,N+1):
    if is_prime[p] == 0:
      continue
    P.append(p)
    for d in range(2,N//p+1):
      q = p*d
      is_prime[q] = 0
  return P

def ques(y):
  print('?',y)

N = int(input())

P = Eratosthenes(N)
D = [0 for i in range(len(P))]

for i in range(len(P)):
  p = P[i]
  for d in range(1,20):
    n = pow(p,d)
    if n > N:
      break
    ques(n)
    z = int(input())
    if n == z:
      D[i] = d
    else:
      break

ans = 1
for i in range(len(P)):
  p,d = P[i],D[i]
  ans *= pow(p,d)
print('!',ans)
0