# WHY THIS CODE DIDN'T ACCEPTED DURING COOK-A-CODE

@mittal_sahab
this is my code
https://www.codechef.com/viewsolution/30003297

this is another code
https://www.codechef.com/viewsolution/29998224
and this code got accepted and my code give wrong answer???

I think it is because of using unsigned ??

Because, your team name is Hume_kuch_nahi_aata.
So, tumhara solution meh AC bhi nahi aata hae.

https://www.codechef.com/viewsolution/30003068

this is my code without unsigned long long int but this also got wrong answer

1 Like

please donâ€™t joke this is not a platform to joke

@anon44231457 Yes, i can help you. there is a wrong in your answer. the solution should be in O(1) but i donâ€™t think your solution followed that formation.

just check it once it is O(1)

@anon44231457 in your first else why didnâ€™t you give indentation?

``````         if(n<=k)
{
cout<<"A\n";
}
else
{
if((n)%(k+1)==0)
{
cout<<"B\n";
}
else
``````

can you explain briefly??
It is a c++ code not python

Yes, i was wrong. I think I have to analysis the logic carefully. I will find the mistake soon and then tell you.

Just add this line after cin>>n>>k; and try

assert(n>0);

2 Likes

but why??
i have never use this assert

How did you submit it now ?
The problems are not yet made public ??

but why the other code got accepted. that also doesnâ€™t have any assert thingâ€¦

his submission time was 2020-03-02 00:04:08

1 Like

If n=0 then your code and accepeted code will give different results.
According to constraints n should not be 0.
But what if wrong test cases?

2 Likes

the submission is during contest

1 Like

I guess it has something to do with the brackets in the if statement of the else part.
Try `if((n%(k+1))==0)` and then try to submit.

but in the constraint n>=1

@akash19jain how is that even possible that brackets make answer wrong â€¦ pls dont guessâ€¦