結果

問題 No.45 回転寿司
ユーザー idkqh7
提出日時 2014-10-19 16:11:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 381 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-24 07:13:46
合計ジャッジ時間 2,154 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
V = map(int,input().split())

if N < 2:
    print(V[0])
else:
    yummy = [0] * int(N/2)
    yummy[0] = max(V[0], V[1])
    j = 1
    for i in range(3, N, 2):
        yummy[j] = yummy[j-1] + max(V[i], V[i-1])
        j += 1
    j -= 1
    if N % 2 == 1:
        if V[N-2] < V[N-1]:
            yummy[j] = yummy[j-1] + V[N-1]

    print(yummy[j])
0