結果

問題 No.45 回転寿司
ユーザー souhei o
提出日時 2022-12-05 12:18:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 520 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-12 09:57:23
合計ジャッジ時間 2,400 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 RE * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
w_list = [0]+list(map(int, input().split()))

def max_score(N, w_list):
    score_list=[0]*(N+1)
    score_list[1]=w_list[1]
    if w_list[1]>w_list[2]:
        score_list[2]=w_list[1]
    else:
        score_list[2]=w_list[2]
    for i in range(3, N+1):
        score1=score_list[i-2]+w_list[i]
        score2=score_list[i-1]
        if score1>score2:
            score_list[i]=score1
        else:
            score_list[i]=score2
            
    return score_list[N]
    
print(max_score(N, w_list))
0