asp小偷源码
2024-12-27 15:08
1.C语言程序编写——折半查找法
C语言程序编写——折半查找法
#include<stdio.h>
int main()
{ int a[]={ ,折找法折半.net源码手机网站源码,,,,,9,8,7,6,5,4,3,1,0};
int l=0,r=,mid,x;
scanf("%d",&x);
do
{ mid=(l+r)/2;
if(a[mid]==x)break;
if(x>a[mid])r=mid-1;
else l=mid+1;
}while(l<=r);
if(a[mid]==x)
printf("a[%d]=%d\n",mid,x);
else
printf("无此数\n");
return 0;
}
2024-12-27 14:30
2024-12-27 14:16
2024-12-27 14:09
2024-12-27 14:04
2024-12-27 13:25
2024-12-27 12:56
2024-12-27 12:56
2024-12-27 12:27