結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2019-06-22 00:43:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 381 bytes |
| コンパイル時間 | 493 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-12-26 01:08:16 |
| 合計ジャッジ時間 | 2,805 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 3 |
| other | RE * 30 |
ソースコード
def main():
n = int(input())
sushi_plates = list(map(int,input().split()))
if n == 1:
print(sushi_plates.pop())
exit()
else:
dp = [0] + (n + 1)
dp[1] = sushi_plates[1]
for i in range(2, n + 1):
dp[i] = max(dp[i - 1], dp[i - 2] + sushi_plates[i - 1])
print(dp[n])
if __name__ == '__main__':
main()