結果
| 問題 |
No.1917 LCMST
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 01:06:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 548 ms |
| コンパイル使用メモリ | 81,608 KB |
| 実行使用メモリ | 224,288 KB |
| 最終ジャッジ日時 | 2025-04-16 01:08:05 |
| 合計ジャッジ時間 | 15,356 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 33 |
ソースコード
import sys
import math
def main():
input = sys.stdin.read().split()
n = int(input[0])
a = list(map(int, input[1:n+1]))
x = min(a)
cnt = a.count(x)
sum_lcm = 0
for num in a:
if num != x:
g = math.gcd(x, num)
sum_lcm += x * num // g
total = (cnt - 1) * x + sum_lcm
print(total)
if __name__ == "__main__":
main()
lam6er