>Description
一共有n个礼物,由m个朋友来买,每个朋友的钱都一样,但是不能几个朋友一起买1个礼物,一个礼物只能由1个朋友来买,且1个朋友可以买多个礼物。
求朋友的最少钱数为多少。
>Input
第一行输入两个用空格隔开的正整数N和M
以下N行每行一个不超过10000正整数,依次表示礼物的价格。
>Output
一个整数,即最高借款量。
>Sample Input
7 5
100
400
300
100
500
101
400
>Sample Output
500
数据范围:
30%:n <=10
60%: n<=1000
100%: n<=100000
>解题思路
二分答案。
>代码
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m,a[100005],l,r,mid