結果
| 問題 | No.505 カードの数式2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-28 12:14:44 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 503 bytes |
| 記録 | |
| コンパイル時間 | 555 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 81,024 KB |
| 最終ジャッジ日時 | 2026-04-30 10:39:54 |
| 合計ジャッジ時間 | 24,697 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 4 |
ソースコード
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
from itertools import permutations,product,combinations_with_replacement,groupby,accumulate,combinations
N = int(input())
A = list(map(int,input().split()))
ans = 0
for L in product((0,1,2),repeat = N - 1):
ret = A[0]
for i in range(N - 1):
if L[i] == 0:
ret += A[i + 1]
elif L[i] == 1:
ret -= A[i + 1]
else:
ret *= A[i + 1]
ans = max(ans,ret)
print(ans)