結果

問題 No.45 回転寿司
ユーザー 坂口春斗
提出日時 2025-03-07 16:45:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 205 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-03-07 16:45:29
合計ジャッジ時間 2,926 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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