Problem Link: CodeChef: Practical coding for everyone
Feedback
I finished the code code runs correctly but ı do not know MAybe Codechef system accepts only one format answer. System does not accept my code as a correct answer when I submit the code
Answer is “Wrong Answer”.
Can anyone say me that why this happens to me lots of time ?
I tested my code many times with different inputs. All are Correct.
My code :
#include <stdio.h>
int main(void) {
// your code goes here
int t,N;
scanf("%d",&t);
while(t--)
{
int res=0;
scanf("%d",&N);
for (int i=1;i<=N;i++)
{
res = res + i;
}
if(res%2 ==0)
printf("%d\n",N);
else
{
int i=0;
for (i;N-i>0;i++)
{
res = res - (N-i);
if(res%2==0)
{ N = N-(i+1);
break;
}
}
printf("%d\n",N);
}
}
return 0;
}