Problem Link: CodeChef: Practical coding for everyone
Feedback
When I Run my code for the problem output is Ok I mean correct. But when i submit the code The result is : WA : Wrong Answer.
My code output is correct. What can be the reason?
Problem Link: CodeChef: Practical coding for everyone
When I Run my code for the problem output is Ok I mean correct. But when i submit the code The result is : WA : Wrong Answer.
My code output is correct. What can be the reason?
int main(void) {
// your code goes here
int t,A,B,C,res;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&A,&B,&C);
if(A>B && B>C)
res = A+B;
else if(A>C && C>B)
res = A+C;
else if(B>A && A>C)
res = B+A;
else if(B>C && C>A)
res = B+C;
else if(C>A && A>B)
res = C+A;
else if(C>B && B>A)
res = C+B;
printf("%d\n",res);
}
return 0;
}
Code is this. In the “Run” output is ok.
Bu Submit ----> Wrong Answer.
Can you say something??
check this code you missed the logic.
#include<stdio.h>
int main(void)
{
int t,A,B,C,res;
scanf(“%d”,&t);
while(t–)
{
scanf(“%d%d%d”,&A,&B,&C);
int d=A+B;
int e=B+C;
int f=A+C;
if(d>=e && d>=f)
res=d;
if(e>=d && e>=f)
res=e;
if(f>=d && f>=e)
res=f;
printf(“%d\n”,res);
}
return 0;
}
Hmm. Ok I got it. thanks for the help yaswanth
welcome all the best