結果

問題 No.505 カードの数式2
ユーザー kohei2019kohei2019
提出日時 2022-02-02 20:13:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 77,028 KB
最終ジャッジ日時 2023-09-02 02:57:21
合計ジャッジ時間 4,053 ms
ジャッジサーバーID
(参考情報)
judge13 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,228 KB
testcase_01 AC 75 ms
71,488 KB
testcase_02 AC 85 ms
76,556 KB
testcase_03 AC 70 ms
71,292 KB
testcase_04 AC 76 ms
71,400 KB
testcase_05 AC 72 ms
71,380 KB
testcase_06 AC 74 ms
71,132 KB
testcase_07 AC 73 ms
71,364 KB
testcase_08 AC 71 ms
71,424 KB
testcase_09 AC 70 ms
70,992 KB
testcase_10 AC 70 ms
71,320 KB
testcase_11 WA -
testcase_12 AC 71 ms
71,236 KB
testcase_13 WA -
testcase_14 AC 71 ms
71,232 KB
testcase_15 WA -
testcase_16 AC 71 ms
71,184 KB
testcase_17 WA -
testcase_18 AC 73 ms
71,256 KB
testcase_19 WA -
testcase_20 AC 80 ms
76,608 KB
testcase_21 AC 87 ms
76,372 KB
testcase_22 WA -
testcase_23 AC 87 ms
76,580 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 88 ms
76,624 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 83 ms
76,648 KB
testcase_31 AC 85 ms
76,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsa = list(map(int,input().split()))
c = -float('INF')
for i in range(2**(N-1)):
    a = lsa[0]
    for j in range(N-1):
        if (i >> j) & 1:
            a *= lsa[j+1]
        else:
            if lsa[j+1] >= 0:
                a += lsa[j+1]
            else:
                a -= lsa[j+1]
    c = max(c,a)
print(c)
0