Monthly Expense--CSU-ACM2017暑假集训2-二分搜索
来源:互联网 发布:微信朋友圈数据采集 编辑:程序博客网 时间:2024/05/30 07:12
Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi ≤ 10,000) that he will need to spend each day over the next N (1 ≤ N ≤ 100,000) days.
FJ wants to create a budget for a sequential set of exactly M (1 ≤ M ≤ N) fiscal periods called "fajomonths". Each of these fajomonths contains a set of 1 or more consecutive days. Every day is contained in exactly one fajomonth.
FJ's goal is to arrange the fajomonths so as to minimize the expenses of the fajomonth with the highest spending and thus determine his monthly spending limit.
Input
Line 1: Two space-separated integers: N and M
Lines 2.. N+1: Line i+1 contains the number of dollars Farmer John spends on the ith day
Output
Line 1: The smallest possible monthly limit Farmer John can afford to live with.
Sample Input
7 5
100
400
300
100
500
101
400
Sample Output
500
Hint
If Farmer John schedules the months so that the first two days are a month, the third and fourth are a month, and the last three are their own months, he spends at most $500 in any month. Any other method of scheduling gives a larger minimum monthly limit.
- Monthly Expense--CSU-ACM2017暑假集训2-二分搜索
- CSU-ACM2017暑假集训2-二分搜索 poj-32732 Monthly Expense
- csu-acm2017暑假集训2-二分搜索D
- CSU-ACM2017暑假集训2-二分搜索 hdu2119
- CSU-ACM2017暑假集训2-二分搜索 F
- CSU-ACM2017暑假集训2-二分搜索 E
- CSU-ACM2017暑假集训2-二分搜索 A
- CSU-ACM2017暑假集训2-二分搜索 poj3104-drying
- CSU-ACM2017暑假集训2-二分搜索 D
- CSU-ACM2017暑假集训2-二分搜索 C
- CSU-ACM2017暑假集训2-二分搜索 hdu2141- Can you find it?
- CSU-ACM2017暑假集训2-二分搜索 poj-2785-4 Values whose Sum is 0
- CSU-ACM2017暑假集训2-二分搜索 poj-2456 Aggressive cows-最大化最小值
- Can you find it? --CSU-ACM2017暑假集训2-二分搜索
- Can you solve this equation?--CSU-ACM2017暑假集训2-二分搜索
- 4 Values whose Sum is 0 --CSU-ACM2017暑假集训2-二分搜索
- CSU-ACM2017暑假集训2-二分搜索 poj-3258- River Hopscotch
- CSU-ACM2017暑假集训比赛2 C
- fl studio(水果音乐制作软件中文版) v12.4.2.33 官方中文版
- 消息队列应用场景
- Junit使用教程(三)
- 通话原理
- Intellij IDEA配置优化
- Monthly Expense--CSU-ACM2017暑假集训2-二分搜索
- 记住密码功能的制作
- Java包装类
- 50天iOS挑战(Swift)
- HDU 2199 Can you solve this equation?
- python实现SMTP客户端
- 嫌Word转换太麻烦!那是你没选对转换工具
- [RK3288][Android6.0] WiFi之网络时间定期同步更新
- xml与map之间互转(java)