結果

問題 No.505 カードの数式2
ユーザー kohei2019kohei2019
提出日時 2022-02-02 20:10:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 339 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 77,524 KB
最終ジャッジ日時 2023-09-02 02:56:52
合計ジャッジ時間 34,315 ms
ジャッジサーバーID
(参考情報)
judge14 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,248 KB
testcase_01 AC 82 ms
76,744 KB
testcase_02 TLE -
testcase_03 AC 72 ms
71,464 KB
testcase_04 AC 73 ms
71,580 KB
testcase_05 AC 73 ms
71,604 KB
testcase_06 AC 70 ms
71,324 KB
testcase_07 AC 72 ms
71,196 KB
testcase_08 AC 70 ms
71,440 KB
testcase_09 AC 73 ms
71,552 KB
testcase_10 AC 72 ms
71,464 KB
testcase_11 WA -
testcase_12 AC 73 ms
71,376 KB
testcase_13 AC 77 ms
76,428 KB
testcase_14 AC 74 ms
71,172 KB
testcase_15 AC 74 ms
71,308 KB
testcase_16 AC 77 ms
76,436 KB
testcase_17 WA -
testcase_18 AC 77 ms
71,420 KB
testcase_19 AC 84 ms
76,748 KB
testcase_20 AC 85 ms
76,796 KB
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 WA -
testcase_30 TLE -
testcase_31 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
lsa = list(map(int,input().split()))
c = -float('INF')
for p in itertools.product(range(3),repeat=N-1):
    a = lsa[0]
    for i in range(1,N):
        if p[i-1] == 0:
            a += lsa[i]
        elif p[i-1] == 1:
            a *= lsa[i]
        else:
            a -= lsa[i]
    c = max(c,a)
print(c)
0