检查不出错误,却无法运行,求大神指导哪里错了
#include<stdio.h>#define MAX_N 1000000
void solved(int a[ ],int n)
{
int ub=n,lb=-1;
while(ub-lb>1)
{
int mid=(lb+ub)/2;
if(a[mid]>=k)
ub=mid;
else
lb=mid;
}
printf("%d\n",ub);
}
int main()
{
int n,k,i,m;
int a[MAX_N];
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
m=solved(a,n)
printf("%d\n",m);
return 0;
}