I am getting wrong answer for the loc june17 KCHAR problem.
According to me my answer is correct…i checked that for many test cases…and it worked correctly.
Still getting WA…can somebody help?
#include
#include
#include
using namespace std;
int main()
{
long long t,m,b[62]={0},s,j=0;
while(pow(2,j+2)<=pow(10,18))
{
s = pow(2,j+2);
b[j] = s;
j++;
}
cin>>t;
while(t–)
{
long long flag=0,l,i,k;
long double n;
cin>>k;
if(k==4){
cout<<"a"<<endl;
continue;
}
else if(k%4==1)
{
cout<<"a"<<endl;
continue;
}
else if(k%4==3)
{
cout<<"c"<<endl;
continue;
}
else
{
if((k+6)%8==0)
{
cout<<"a"<<endl;
continue;
}
else
{
if(k%4!=0)
{
cout<<"c"<<endl;
continue;
}
for(i=0;i<j;i++)
{
if(i==j-1 || (k>=b[i] && k<b[i+1]))
{
l = (k-b[i])/4;
if(l<i){
flag=1;
}
break;
}
}
}
if(flag==1)
cout<<"a"<<endl;
else
cout<<"c"<<endl;
}
}
}