fork download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. #define ll long long
  5.  
  6. bool is(ll x)
  7. {
  8. // logarithm function to calculate value
  9. ll res1 = log10(x);
  10. long double res2 =log10(x); // Note : this is double
  11.  
  12. // compare to the result1 or result2 both are equal
  13. return (res1 == res2);
  14. }
  15.  
  16. int main() {
  17. ll t;
  18. cin>>t;
  19. while(t--)
  20. {
  21. ll n,flag=0,i=0;
  22. cin>>n;
  23. while(n>=pow(10,i))
  24. {
  25. if(is(n))
  26. {
  27. flag=1;
  28. break;
  29. }
  30. if(n%2==0)
  31. n=n/2;
  32. i++;
  33. }
  34. if(flag==1)
  35. cout<<"Yes"<<endl;
  36. else
  37. cout<<"No"<<endl;
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0s 4400KB
stdin
1
21
stdout
No