結果

問題 No.505 カードの数式2
ユーザー 0w10w1
提出日時 2017-04-21 22:38:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 291 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 76,952 KB
最終ジャッジ日時 2023-09-27 11:23:17
合計ジャッジ時間 3,701 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,120 KB
testcase_01 AC 63 ms
71,228 KB
testcase_02 AC 86 ms
76,916 KB
testcase_03 AC 66 ms
71,212 KB
testcase_04 AC 63 ms
71,352 KB
testcase_05 AC 66 ms
71,100 KB
testcase_06 AC 65 ms
71,372 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 62 ms
71,044 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 63 ms
71,068 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 62 ms
71,220 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 67 ms
75,640 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 87 ms
76,828 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int( input() )
A = list( map( int, input().split() ) )

ans = 0
def dfs( x, v ):
  if x == N:
    global ans
    ans = max( ans, v )
    return
  if A[ x ] < 0:
    dfs( x + 1, v - A[ x ] )
  if A[ x ] > 0:
    dfs( x + 1, v + A[ x ] )
  dfs( x + 1, v * A[ x ] )
dfs( 0, 0 )
print( ans )
0