#include <stdio.h> int halfsearch(int a[],int n,int x); int main() { int a[10]={4,5,7,8,10,12,16,18,20,30},n,x; scanf("%d",&x); if(n=halfsearch(a,10,x)!=-1) printf("%d %d",x,n); else ; return 0; } int halfsearch(int a[],int n,int x) { int s=0,e=n-1,m; while(s<=e) { m=(s+e)/2; if(a[m]==x) return m; else if(x>a[m]) s=m+1; else e=e-1; } return -1; }