結果

問題 No.1917 LCMST
ユーザー lam6er
提出日時 2025-03-20 20:33:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 261 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 225,276 KB
最終ジャッジ日時 2025-03-20 20:34:39
合計ジャッジ時間 17,219 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
a = list(map(int, input().split()))
m = min(a)

sum_lcm = 0
for num in a:
    gcd_val = math.gcd(m, num)
    sum_lcm += m * num // gcd_val

# Subtract m because the center node is counted once in the sum
sum_lcm -= m
print(sum_lcm)
0