結果

問題 No.1917 LCMST
ユーザー gew1fw
提出日時 2025-06-12 14:57:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 224,660 KB
最終ジャッジ日時 2025-06-12 14:59:12
合計ジャッジ時間 20,032 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys

def main():
    input = sys.stdin.read
    data = input().split()
    N = int(data[0])
    A = list(map(int, data[1:N+1]))
    m = min(A)
    c = A.count(m)
    total = (c - 1) * m
    for a in A:
        if a != m:
            g = math.gcd(a, m)
            lcm = (a * m) // g
            total += lcm
    print(total)

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