import java.io.*;
class bogo{
public static void main(String args[])throws IOException{
BufferedReader ne = new BufferedReader(new InputStreamReader(System.in));
int m[] = new int[10];
for(int i=0;i<10;i++)
m[i]=Integer.parseInt(ne.readLine());
int s = Integer.parseInt(ne.readLine());
int f=0,l=0,mid=0,k=0;
while(f<=l){
mid=(f+l)/2;
if(m[mid] > s)
l=mid-1;
if(m[mid]<s)
f=mid+1;
if(m[mid]==s){
k=1;
break;
}
}
if(k == 1){
System.out.println("Found");
}
}
}
compile as javac bogo.java
run as java bogo
0 comments:
Post a Comment