結果

問題 No.45 回転寿司
ユーザー maburoe
提出日時 2019-06-18 14:18:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-30 07:48:17
合計ジャッジ時間 1,892 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 1 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
sushi_plates = list(map(int, input().split()))
sushi_plates.reverse()

if n == 1:
    print(sushi_plates.pop())
    exit()

total = 0
index = 0
while index < n - 1:
    first = sushi_plates[index]
    second = sushi_plates[index + 1]

    if first > second:
        total += first
        index += 2
    else:
        total += second
        index += 3

print(total)
0