Hey guys i have written the following code to calculate the max power.But iam getting Wrong answer.I want to know which case its failing and its constraints.
#include<iostream>
#include<cmath>
using namespace std;
int main(){
unsigned long long X,N;
cin>>N;
cin>>X;
unsigned long long count=0,value=0,h_power=0,index=0;
while(X!=0)
{
if(X%10 == 1)
{
index=pow(2,count);
value=index+value;
if((value%index)==0)
{
h_power=count;
}
}
X=X/10;
count++;
}
cout<<h_power<<endl;
return 0;
}
Thanks