std::uint32_t BinarySearch(std::uint32_t X, std::uint32_t Add, int Judge){
if(Add ==0) Add =1;
if(Judge ==1)return X + Add;
if(Judge ==-1)return X - Add;
return X;
}
int main(){
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_int_distribution<std::uint32_t> uid;
std::uint32_t X = std::numeric_limits<std::uint32_t>::max();
std::uint32_t Add = X;
std::uint32_t A = uid(mt);
int i =0;
int Judge =-1;
do{
Add /=2;
X = BinarySearch(X, Add, Judge);
Judge = AboutX(X, A);
i++;
}while(Judge !=0);
std::cout<<"X=>"<< X <<','<<"Answer=>"<< A <<' '<< std::endl<<"Search for "<<i<<" Count!"<< std::endl<<"this is "<<((A == X)?"Valid":"Invalid")<< std::endl;