int main()
{
int left=0;
int arr[10]={1,2,3,3,4,5,6,8,9};
int sz=sizeof(arr)/sizeof(arr[0]);
int right=sz;
int k=7;
int a;
while(left<=right)
{
a=(right+left)/2;
if(arr[a]>k)
{
right=a-1;
}
else if(arr[a]<k)
{
left=a+1;
}
else if(k==arr[a])
{
printf("找到了a= %d\n",a);
break;
}
}
if(left>right)
{
printf("没找到了\n");
}
return 0;
}