結果

問題 No.45 回転寿司
ユーザー sqdope
提出日時 2017-07-18 15:27:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 276 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-27 16:40:14
合計ジャッジ時間 2,273 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
v = [int(i) for i in input().split()]
d = []
if len(v)>1:
    for i in range(0,n):
        d.append([])
    d[0]=v[0]
    d[1]=max(v[0],v[1])

    for i in range(2,n):
        d[i]=max(d[i-1],d[i-2]+v[i])

    ans=d.pop()
    print(ans)
else:
    print(v[0])
0