We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
i am trying to solve the question by doing operations on n....but getting only 11 points....please help where am i going wrong
#include<cmath>#include<cstdio>#include<vector>#include<iostream>#include<algorithm>usingnamespacestd;intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */intt;cin>>t;for(intv=1;v<=t;v++){longlongn,c=0;cin>>n;while(n>1){if(((n)&(n-1))==0)n=n-(n/2);elsen=n-pow(2,floor(log(n)/log(2)));//cout<<n<<" ";c++;}//cout<<c;if(c%2==0)cout<<"Richard"<<endl;elsecout<<"Louise"<<endl;}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
i am trying to solve the question by doing operations on n....but getting only 11 points....please help where am i going wrong