結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
tachyon777
|
| 提出日時 | 2020-02-13 13:41:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 5,000 ms |
| コード長 | 269 bytes |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 81,992 KB |
| 実行使用メモリ | 53,848 KB |
| 最終ジャッジ日時 | 2024-10-05 18:47:46 |
| 合計ジャッジ時間 | 2,357 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
n = int(input())
lst1 = list(map(int,input().split()))
dp = [0]*n
dp[0] = lst1[0]
if n == 1:
print(dp[-1])
exit()
dp[1] = max(lst1[0],lst1[1])
if n == 2:
print(dp[-1])
exit()
for i in range(1,n):
dp[i] = max(dp[i-1],dp[i-2]+lst1[i])
print(dp[-1])
tachyon777