結果

問題 No.1334 Multiply or Add
ユーザー lam6er
提出日時 2025-04-16 16:02:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 321 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 104,704 KB
最終ジャッジ日時 2025-04-16 16:08:43
合計ジャッジ時間 9,447 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 49 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
a = list(map(int, input().split()))

sum_total = sum(a)

sum_log = 0.0
for num in a:
    sum_log += math.log(num)

mod = 10**9 + 7

if sum_log > math.log(sum_total):
    product = 1
    for num in a:
        product = (product * num) % mod
    print(product)
else:
    print(sum_total % mod)
0