結果
問題 |
No.505 カードの数式2
|
ユーザー |
|
提出日時 | 2022-02-02 20:13:57 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 336 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 62,720 KB |
最終ジャッジ日時 | 2024-06-11 09:34:05 |
合計ジャッジ時間 | 2,369 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 11 |
ソースコード
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)