木板切割问题-二分法

问题描述:

        给出N根木棒,长度均已知,现在希望通过切割它们来得到至少K段长度相等的木棒(长度必须为整数),问这些长度相等的木棒最长能有多长。

样例输入:

3 7

10 24 15

样例输出

6

#include 
#include
#include
using namespace std;
const int N=1e+3+10;
int n;
int solve(int a[],int left,int right,int k){
	int mid,num;
	while(left=k){//寻找第一个num

 

你可能感兴趣的:(算法,题目集,笔记)