結果
| 問題 | 
                            No.1917 LCMST
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-04-15 23:58:53 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 488 bytes | 
| コンパイル時間 | 370 ms | 
| コンパイル使用メモリ | 81,896 KB | 
| 実行使用メモリ | 250,700 KB | 
| 最終ジャッジ日時 | 2025-04-16 00:00:38 | 
| 合計ジャッジ時間 | 14,518 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 WA * 33 | 
ソースコード
import sys
import math
from collections import Counter
def main():
    input = sys.stdin.read().split()
    n = int(input[0])
    a = list(map(int, input[1:n+1]))
    
    m = min(a)
    freq = Counter(a)
    
    total = (freq[m] - 1) * m
    
    for num in freq:
        if num == m:
            continue
        cnt = freq[num]
        g = math.gcd(m, num)
        lcm = m * num // g
        total += (cnt - 1) * num + lcm
    
    print(total)
if __name__ == "__main__":
    main()
            
            
            
        
            
lam6er