結果

問題 No.45 回転寿司
ユーザー tkr182
提出日時 2018-10-01 13:35:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 239 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-12 09:41:35
合計ジャッジ時間 2,121 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 24 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
V=list(map(int,input().split()))
if N==1:
    print(V[0])
elif N==2:
    print(max(V[0],V[1]))
else:
    a=[0]*(N+1)
    a[0]=V[0]
    a[1]=V[1]
    for i in range(2,N):
        a[i]=max(a[i-1],a[i-2]+V[i])
    print(a[N-1])
0