結果
| 問題 |
No.1917 LCMST
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 20:55:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 409 bytes |
| コンパイル時間 | 303 ms |
| コンパイル使用メモリ | 81,724 KB |
| 実行使用メモリ | 224,408 KB |
| 最終ジャッジ日時 | 2025-06-12 20:59:07 |
| 合計ジャッジ時間 | 16,315 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 33 |
ソースコード
import math
import sys
def main():
input = sys.stdin.read().split()
n = int(input[0])
a = list(map(int, input[1:n+1]))
x = min(a)
count_x = a.count(x)
sum_total = 0
for num in a:
if num == x:
continue
g = math.gcd(x, num)
sum_total += (x * num) // g
sum_total += (count_x - 1) * x
print(sum_total)
if __name__ == "__main__":
main()
gew1fw