You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
838 B

///*
// * tree01.cpp
// *
// * Created on: Apr 6, 2024
// * Author: 28032
// */
//
//#include <iostream>
//#include <cmath>
//
//using namespace std;
//
//int main()
//{
// int T = 0;
//
// cin>>T;
//
// while(T--)
// {
// int a,b,c,
// h = -1;
// cin>>a>>b>>c;
//
// if(a != c-1) //a*2+b != a+b+c-1
// {
// cout<<h<<endl;
// continue;
// }
//
// h = floor(log(a+1)/log(2)-1);
// a = a - pow(2,h+1)+1;
//
// if(a < 0)
// {
// cout<<h+b<<endl;
// }
// else if(a == 0)
// {
// int cc = pow(2,h+1);
// h+=(ceil(double(b)/cc)+1);
// cout<<h<<endl;
// }
// else
// {
// int cc = pow(2,h+1)+a;
// h++;
//
// if(pow(2,h) - a >= b)
// {
// h++;
// }
// else
// {
// b-=(pow(2,h) - a);
// h+=(ceil(double(b)/cc)+1);
// }
// cout<<h<<endl;
// }
// }
//
//
//
// return 0;
//}
//
//
//