結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2018-10-01 13:42:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 5,000 ms |
| コード長 | 249 bytes |
| コンパイル時間 | 2,088 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-12-27 19:38:20 |
| 合計ジャッジ時間 | 3,372 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
N=int(input())
V=list(map(int,input().split()))
if N==1:
print(V[0])
elif N==2:
print(max(V[0],V[1]))
else:
a=[0]*(N+1)
a[0]=V[0]
a[1]=max(V[0],V[1])
for i in range(2,N):
a[i]=max(a[i-1],a[i-2]+V[i])
print(a[N-1])