結果
| 問題 |
No.937 Ultra Sword
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-30 15:00:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 461 bytes |
| コンパイル時間 | 410 ms |
| コンパイル使用メモリ | 82,828 KB |
| 実行使用メモリ | 165,320 KB |
| 最終ジャッジ日時 | 2024-11-21 03:23:05 |
| 合計ジャッジ時間 | 10,398 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 13 RE * 19 TLE * 1 |
ソースコード
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)