結果

問題 No.1917 LCMST
ユーザー gew1fw
提出日時 2025-06-12 20:01:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 81,972 KB
実行使用メモリ 219,268 KB
最終ジャッジ日時 2025-06-12 20:06:06
合計ジャッジ時間 14,445 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math

def main():
    n = int(sys.stdin.readline())
    A = list(map(int, sys.stdin.readline().split()))
    x = min(A)
    k = A.count(x)
    total = 0
    for a in A:
        g = math.gcd(x, a)
        lcm = x * a // g
        total += lcm
    if k > 1:
        total -= x * (k - 1)
    else:
        total -= x
    print(total)

if __name__ == "__main__":
    main()
0