Help me in solving LUCNUM problem

My issue

even if code is crt it shows wrong amswer i have tried failed input but it is giving crt output

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	long long int t;
	cin>>t;
	while(t--)
	{
	    long long int n,p=0;
	    cin>>n;
	    while(n!=0)
	    {
	        if (n%2==0)
	        {
	            p++;;
	            n=n/2;
	        }
	        else 
	          break;
	        
	   }
	   if (p%2==0)
	   {
	       cout<<"1"<<endl;
	   }
	   else
	    cout<<"0"<<endl;
	    
	}
	return 0;
}

Problem Link: CodeChef: Practical coding for everyone

@ramkrishna_24
Your code is working fine i have submitted it its shows ac.
here is the submission link:-
https://www.codechef.com/viewsolution/1010918721

1 Like