#P2034. 选择数字
选择数字
Description
Given a sequence of non-negative integers . You may choose some of them, but no more than consecutive numbers can be chosen. Your task is to maximize the sum of the chosen numbers.
Input Format
The first line contains two integers .
The following lines each contain one integer, representing .
Output Format
Output a single value representing the answer.
5 2
1
2
3
4
5
12
Hint
For of the testdata, .
For another of the testdata, .
For of the testdata, .
For of the testdata, , , .
Time limit: 500 ms.
Translated by ChatGPT 5
京公网安备 11011102002149号