結果

問題 No.505 カードの数式2
ユーザー tookunn_1213
提出日時 2017-04-21 23:08:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-20 15:14:55
合計ジャッジ時間 1,794 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = [int(i) for i in input().split()]
def dfs(n):
	if n == 0:
		return a[n]
	res = dfs(n-1)
	ret = -10**17
	ret = max(ret,res + a[n])
	ret = max(ret,res - a[n])
	ret = max(ret,res * a[n])
	if a[n] != 0:
		ret = max(ret,res // a[n])
	return ret
print(dfs(N-1))
0