39 lines
379 B
C++
39 lines
379 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int a[11]={5, 13, 19, 21, 37, 56, 64, 75, 80, 88, 92};
|
|
|
|
int main()
|
|
{
|
|
int x;
|
|
cin>>x;
|
|
int l=0,r=10;
|
|
int ans;
|
|
while(l<=r)
|
|
{
|
|
int mid=(l+r)/2;
|
|
if(x==a[mid])
|
|
{
|
|
cout<<mid;
|
|
return 0;
|
|
}
|
|
if(x<a[mid])
|
|
{
|
|
r=mid-1;
|
|
}
|
|
else
|
|
{
|
|
ans=mid;
|
|
l=mid+1;
|
|
}
|
|
}
|
|
cout<<"Not found!";
|
|
|
|
return 0;
|
|
}
|
|
|
|
//5
|
|
//1 -2 3 1 -4
|
|
|
|
|