結果

問題 No.505 カードの数式2
ユーザー Takashi MakinoTakashi Makino
提出日時 2017-04-23 22:54:18
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 1,572 ms
コンパイル使用メモリ 6,456 KB
実行使用メモリ 6,240 KB
最終ジャッジ日時 2023-09-29 16:04:01
合計ジャッジ時間 3,665 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,028 KB
testcase_01 AC 11 ms
5,996 KB
testcase_02 AC 11 ms
5,968 KB
testcase_03 AC 11 ms
6,064 KB
testcase_04 AC 10 ms
5,992 KB
testcase_05 AC 11 ms
5,968 KB
testcase_06 WA -
testcase_07 AC 11 ms
5,920 KB
testcase_08 AC 11 ms
5,924 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 11 ms
5,964 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 11 ms
6,040 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 11 ms
6,044 KB
testcase_20 AC 11 ms
6,144 KB
testcase_21 AC 11 ms
5,992 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 11 ms
5,960 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8

def readData():
    n   = input()
    a_n = []
    while len(a_n) != n:
        a_n = map(int, raw_input().split())

    return n, a_n

def caluclateCards(n, a_n):
    ans = 0
    for i in xrange(n):

        if i == 0:
            ans = abs(a_n[i])
        else:
            if ans == 0:
                ans += abs(a_n[i])
            else:
                if a_n[i] == 0 or abs(a_n[i]) == 1:
                    ans += abs(a_n[i])
                else:
                    ans *= abs(a_n[i])

    print ans

if __name__ == "__main__":
    n, a_n = readData()
    caluclateCards(n, a_n)
0