結果

問題 No.45 回転寿司
ユーザー nebukuro09
提出日時 2016-09-03 09:27:22
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 235 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-11-24 17:24:24
合計ジャッジ時間 1,600 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
V = map(int, raw_input().split())
mem = [0 for i in xrange(N)]

def rec(n):
    if n >= N:
        return 0
    if mem[n] > 0:
        return mem[n]
    mem[n] = max(rec(n+1), rec(n+2)+V[n])
    return mem[n]

print rec(0)
0