結果

問題 No.505 カードの数式2
ユーザー Watson
提出日時 2017-08-03 09:08:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-10-11 20:18:24
合計ジャッジ時間 1,976 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = [int(i) for i in input().split()]
ans = a[0]
for i in range(1,N):
    if a[i] == 0 or a[i] == 1:
        ans += a[i]
    elif a[i] < 0:
        ans -= a[i]
    else:
        if ans*a[i] > ans+a[i]:
            ans *= a[i]
        else:
            ans += a[i]
print(ans)
0