結果

問題 No.505 カードの数式2
ユーザー tookunn_1213tookunn_1213
提出日時 2017-04-21 22:50:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-09-27 12:17:18
合計ジャッジ時間 2,148 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,764 KB
testcase_01 AC 13 ms
7,860 KB
testcase_02 AC 28 ms
7,864 KB
testcase_03 AC 13 ms
7,796 KB
testcase_04 WA -
testcase_05 AC 13 ms
7,768 KB
testcase_06 AC 13 ms
7,904 KB
testcase_07 WA -
testcase_08 RE -
testcase_09 WA -
testcase_10 RE -
testcase_11 WA -
testcase_12 AC 12 ms
7,904 KB
testcase_13 WA -
testcase_14 AC 13 ms
7,864 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 12 ms
7,784 KB
testcase_19 RE -
testcase_20 AC 12 ms
7,860 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 RE -
testcase_29 WA -
testcase_30 AC 14 ms
7,852 KB
testcase_31 AC 19 ms
7,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = [int(i) for i in input().split()]
ans = -10**10
def dfs(n,m):
	if n == N:
		global ans
		ans = max(ans,m)
		return
	if a[n] > 0:
		dfs(n+1,m + a[n])
	if a[n] < 0:
		dfs(n+1,m - a[n])
	if (m > 0 and a[n] > 0) or (m < 0 and a[n] < 0):
		dfs(n+1,m * a[n])
	if m < 0 and a[n] < 0:
		dfs(n+1,m // a[i])
	return
dfs(1,a[0])
print(ans)
0