摘要:
View Code #include<stdio.h>int fn(int * a,int n,int x){ int s=0,e=n-1; int mid; while(s<=e) { mid=(s+e)>>1; if(a[mid] == x) return mid; else if(a[mid] > x) e=mid-1; else s=mid+1; } return -1;}int main(){ int i,a[10]; for(i=0;i<10;i++) { a... 阅读全文