注意点:judge单独写一个bool函数,更方便构思;二分法时,终止条件需要注意。
#include<iostream>
#include <algorithm>
using namespace std;
int a[100010],n,c;
bool judge(int mid)
{
int sum=1,last=a[0];
注意点:judge单独写一个bool函数,更方便构思;二分法时,终止条件需要注意。
#include<iostream>
#include <algorithm>
using namespace std;
int a[100010],n,c;
bool judge(int mid)
{
int sum=1,last=a[0];