結果

問題 No.937 Ultra Sword
ユーザー pekempeypekempey
提出日時 2019-11-30 15:00:03
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 461 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 95,016 KB
最終ジャッジ日時 2024-05-01 03:05:28
合計ジャッジ時間 7,634 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
77,340 KB
testcase_01 AC 96 ms
77,772 KB
testcase_02 AC 95 ms
77,524 KB
testcase_03 AC 94 ms
77,612 KB
testcase_04 AC 95 ms
77,456 KB
testcase_05 AC 126 ms
90,132 KB
testcase_06 RE -
testcase_07 AC 125 ms
87,524 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 122 ms
89,248 KB
testcase_15 AC 115 ms
84,388 KB
testcase_16 RE -
testcase_17 AC 105 ms
77,804 KB
testcase_18 RE -
testcase_19 AC 107 ms
81,860 KB
testcase_20 RE -
testcase_21 AC 125 ms
89,512 KB
testcase_22 WA -
testcase_23 AC 96 ms
77,636 KB
testcase_24 AC 123 ms
89,628 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce

N = int(input())
A = list(map(int, input().split()))

def gcd(x, y):
  while y != 0:
    if x < y:
      x, y = y, x
    else:
      k = len(str(x)) - len(str(y))
      x -= y << k
  return y

g = reduce(gcd, A)

f = [0] * 100001
for x in A: f[x] += x

souwa = sum(A)
ans = 10**100

for i in range(1, 100001):
  s = sum(f[j] for j in range(i, 100001, i))
  if gcd(i, g) == g:
    ans = min(ans, souwa - s + s // i)

print(ans)

  
0