[100% pass rate] 2023 Huawei OD machine test real questions B paper C language implementation [Coding ability improvement plan]

Table of contents

topic

Ideas

Code


topic

In order to improve the coding ability of the software, Xiao Wang made a plan to solve the questions. He selected n questions in the question bank, numbered from 0 to n-1, and planned to finish all the questions in the order of the question numbers within m days (note that Xiao Wang Wang cannot complete the same question in multiple days.)
In Xiao Wang's question solving plan, Xiao Wang needs to use time[i] to complete question number i. In addition, Xiao Wang can also check the answer, which can save the time of doing the question. . In order to truly achieve the effect of answering questions, Xiao Wang directly looks at the answers at most once a day. We define the day that takes the most time to do the questions out of m days as T (questions that look at the answers directly are not included in the total time to do the questions). Please help Xiao Wang find the smallest T.
Input description
The first line of input is time, and the time of time[i] is used to complete the question number i.

The input in the second line is m, m represents how many days to complete all the questions, 1 <= m <= 180
Output description
Minimum time-consuming integer T
 

Example 1:

Enter
999,999,999

4
outputs

0
description

In the first three days, Xiao Wang looked at the answers directly every day, so that he could complete all the questions within three days without spending any time.

Example 2:
Enter
1,2,2,3,5

Guess you like

Origin blog.csdn.net/misayaaaaa/article/details/133141817