标签:style blog http color os io strong for
#include<stdio.h> int f(int a[],int low,int high,int x) { int mid; while (low<=high) { mid=(low+high)/2; if(a[mid]>x) high=mid-1; else if(a[mid]<x) low=mid+1; else return mid+1; } return 0; } int main() { int a[30],n,i,x,y; while(scanf("%d",&n)!=EOF) { for(i=0;i<=n;i++) scanf("%d",&a[i]); x=a[n]; y=f(a,0,n,x); if ( y==0 ) printf("No found!\n"); else printf("%d\n",y); } return 0; }
#include<stdio.h>
int f(int a[],int low,int high,int x)
{ int mid;
while (low<=high)
{
mid=(low+high)/2;
if(a[mid]>x) high=mid-1;
else if(a[mid]<x) low=mid+1;
else return mid+1;
}
return 0;
}
int main()
{
int a[30],n,i,x,y;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<=n;i++)
scanf("%d",&a[i]);
x=a[n];
y=f(a,0,n,x);
if ( y==0 ) printf("No found!\n");
else printf("%d\n",y);
}
return 0;
}
#include<stdio.h> int a[30],x; int f(int low,int high) { int mid; while (low<=high) { mid=(low+high)/2; if(a[mid]>x) high=mid-1; else if(a[mid]<x) low=mid+1; else return mid; } return -1; } int main() { int n,i,y; while(scanf("%d",&n)!=EOF) { for(i=0;i<=n;i++) scanf("%d",&a[i]); x=a[n]; y=f(0,n-1); if ( y==-1 ) printf("No found!\n"); else printf("%d\n",y+1); } return 0; }
#include<stdio.h>
int a[30],x;
int f(int low,int high)
{ int mid;
while (low<=high)
{
mid=(low+high)/2;
if(a[mid]>x) high=mid-1;
else if(a[mid]<x) low=mid+1;
else return mid;
}
return -1;
}
int main()
{
int n,i,y;
while(scanf("%d",&n)!=EOF)
{ for(i=0;i<=n;i++)
scanf("%d",&a[i]);
x=a[n];
y=f(0,n-1);
if ( y==-1 ) printf("No found!\n");
else printf("%d\n",y+1);
}
return 0;
}
#include<stdio.h> int f(int a[],int low,int high,int x) { int mid; while (low<=high) { mid=(low+high)/2; if(a[mid]>x) high=mid-1; else if(a[mid]<x) low=mid+1; else return mid; } return -1; } int main() { int a[30],n,i,x,y; while(scanf("%d",&n)!=EOF) { for(i=0;i<=n;i++) scanf("%d",&a[i]); x=a[n]; y=f(a,0,n,x); if ( y==-1 ) printf("No found!\n"); else printf("%d\n",y+1); } return 0; }
#include<stdio.h>
int f(int a[],int low,int high,int x)
{ int mid;
while (low<=high)
{
mid=(low+high)/2;
if(a[mid]>x) high=mid-1;
else if(a[mid]<x) low=mid+1;
else return mid;
}
return -1;
}
int main()
{
int a[30],n,i,x,y;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<=n;i++)
scanf("%d",&a[i]);
x=a[n];
y=f(a,0,n,x);
if ( y==-1 ) printf("No found!\n");
else printf("%d\n",y+1);
}
return 0;
}
#include<stdio.h> int f(int a[],int low,int high,int x) { int mid; while (low<=high) { mid=(low+high)/2; if(a[mid]>x) high=mid-1; else if(a[mid]<x) low=mid+1; else return mid+1; } return -1; } int main() { int a[30],n,i,x,y; while(scanf("%d",&n)!=EOF) { for(i=0;i<=n;i++) scanf("%d",&a[i]); x=a[n]; y=f(a,0,n,x); if ( y==-1 ) printf("No found!\n"); else printf("%d\n",y); } return 0; }
#include<stdio.h>
int f(int a[],int low,int high,int x)
{ int mid;
while (low<=high)
{
mid=(low+high)/2;
if(a[mid]>x) high=mid-1;
else if(a[mid]<x) low=mid+1;
else return mid+1;
}
return -1;
}
int main()
{
int a[30],n,i,x,y;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<=n;i++)
scanf("%d",&a[i]);
x=a[n];
y=f(a,0,n,x);
if ( y==-1 ) printf("No found!\n");
else printf("%d\n",y);
}
return 0;
}
标签:style blog http color os io strong for
原文地址:http://www.cnblogs.com/2014acm/p/3902507.html