結果

問題 No.505 カードの数式2
コンテスト
ユーザー h_noson
提出日時 2017-06-13 23:48:01
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 255 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 294 ms
コンパイル使用メモリ 21,468 KB
実行使用メモリ 15,792 KB
最終ジャッジ日時 2026-09-03 08:46:02
合計ジャッジ時間 5,067 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

i = 0
while i < n and a[i] == 0: i += 1
if i == n:
    print(0)
    exit(0)
ans = abs(a[i])
i += 1
for x in a[i:]:
    if abs(x) <= 1:
        ans += abs(x)
    else:
        ans *= abs(x)
print(ans)
0