Huawei OD Machine Test - Coding Ability Improvement Program (Java & JS & Python)

topic description

In order to improve the software coding ability, Xiao Wang made a plan for brushing the questions. He selected n questions in the question bank, numbered from 0 to n-1, and planned to finish all the questions in m days according to the order of the question numbers (note, Xiao Wang cannot use multiple days to complete the same question).

In Xiao Wang's problem solving plan, Xiao Wang needs to use tme[i] time to complete the problem number i.

In addition, Xiao Wang can also check the answer, which can save the time for this question. In order to really achieve the effect of brushing the questions, Xiao Wang directly read the answers at most once a day.

We define the day that takes the most time to do the questions in m days as T (the questions that directly look at the answers are not included in the total time for doing the questions).

Please help Xiao Wang find out what the smallest T is.

enter description

The input in the first line is time, and the time of time[i] is used to complete the title of number i

The input in the second line is m, m means to complete all the questions within a few days, 1 ≤ m ≤ 180

output description

Minimum time-consuming integer T

Example

enter 999,999,999
4
output 0
illustrate In the first three days, Xiao Wang looked directly at the answer every day࿰

Guess you like

Origin blog.csdn.net/qfc_128220/article/details/132517546