aaa

bool check(int mid){

int now = a[1],con=1;

for(int i=2;i<=n;i++){

if(now=a[i]){

now = a[i];

con++;

}

}

if(con>=m)return true;

else return false;

}

 

 

 

int solve(int l,int r){

  int ans = 0,mid;

  while(l<=r){

    mid = (l+r)

    if(check(mid)){

      ans = mid;

      l = mid+1;

    } else r = mid-1;

  }

}

上一篇:字符串的常用方法


下一篇:递归-基础