結果

問題 No.45 回転寿司
ユーザー nanae
提出日時 2016-12-28 09:05:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-27 15:44:41
合計ジャッジ時間 2,318 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

def sushi_max(V):
    s_max2 = 0
    s_max = V[0]
    
    for i in range(1, len(V)):
        if (s_max2 + V[i]) > s_max:
            s_max, s_max2 = s_max2 + V[i], s_max
        else:
            s_max2 = s_max
            
    return s_max

N = int(input())
sara = list(map(int, input().split()))
print(sushi_max(sara))
0