+ 1
Why its showing wrong Answer?????
I have inserted a code in this post. This problem is asked by Codechef starters 6. What is wrong in my code.All test cases shows correct answer in my own IDE in pc..... Even I tried with some other test cases by myself and worked in my pc....but not in codechef. Can anyone help me to debug it?? https://code.sololearn.com/cFJan6SoAWIO/?ref=app
17 ответов
+ 2
Anikur Rahman
I think we missed one thing:
"The person who is better than the other in the most statistics" is a better player.
So I Finally solved by doing this:
https://code.sololearn.com/c50a17A13a13/?ref=app
+ 4
Share your problem, by the looks of it your code can give output only based on one condition
what do you want as output? A or B
Based on your code :
You are taking inputs and comparing a d, b e and c f respectively A should output only if all 3 (abc) are greater than all 3 ( def) which should be simple unless there is more to it
So as been suggested share your problem(challenge link)
edit Anikur Rahman why python?? is tagged
+ 1
u should link the question too. idk how to find it, ive never used that web before
+ 1
doesnt "in the most statistics" means that also 2 out of 3 stats will give u the winner? I think it requires more code, also if u want to include the constraints
+ 1
Well I think I found it..
#include<stdio.h>
int main()
{
int t,a,b,c,d,e,f;
scanf("%d",&t);
for(int i=1;i<=t;i++){
scanf("%d %d %d",&a,&b,&c);
scanf("%d %d %d",&d,&e,&f);
if(a>d && b>e && c>f){
printf("A\n");
}
else if(b>e && c>f){
printf("A\n");
}
else if(a>d && c>f){
printf("A\n");
}
else if(a>d && b>e){
printf("A\n");
}
else{
printf("B\n");
}
}
return 0;
}
if you like the code.....pkease hit upvote.
+ 1
Rupesh Kumar
I did the same....You dont need to repeat my code.😑😑😑😑😑😑😑😑
+ 1
I suggest u to input the values of a,b,c,d,e,f or allow the user for example scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f); not only
t
+ 1
A͢J you did well
+ 1
A͢J
Really very nice code....
And I tried this...it works fine.
+ 1
Did it work?
I meant Accepted by codechef,I think otherwise, because of constraints for example
r != r1
c != c1
w != w1
Imagine user (test-case) gives inputs which are equal for both players
Try for yourself :-)
+ 1
Sriraam SK
Yes it is accepted whice I gave out in comments
https://code.sololearn.com/cFJan6SoAWIO/?ref=app
0
Daljeet Singh
Arturop
You can fibd the problem here...
https://www.codechef.com/START6B/problems/CRICRANK
0
Anikur Rahman
What about to add a, b, c to get sum1 and d, e, f to get sum2 and then compare sum1 and sum2?
https://code.sololearn.com/c6ZWP4KG12Dn/?ref=app
0
A͢J
Well,I tried that one too. But if you try to understand carefully.We need to build a comparative relationship between them.
0
stephen muganyizi
I already took uesr input for a,b,c,d,e,f in an ordered way as asked in question statement in codechef.
- 2
#inclue<stdio.h>
int main()
{
int t,a,b,c,d,e,f;
scanf(“%d”,&t);
for(int i=1;i<=t;i++){
scanf(“%d%d%d”,&a,&b,&c);
scanf(“%d%d%d”,&d,&e,&f);
if(a>d&&b>e&&c>f){
print(“A\n”);
}
else if(b>e&&c>f){
printf(“A\n”);
}
else if(a>d&&c>f){
printf(“A\n”);
}
else if(a>d&&b>e){
print(“A\n”);
}
else{
printf(“B\n”);
}
}
return 0;
}
- 3
#include<stdio.h>
int main()
{
int t,a,b,c,d,e,f;
scanf("%d",&t);
for(int i=1;i<=t;i++){
scanf("%d %d %d",&a,&b,&c);
scanf("%d %d %d",&d,&e,&f);
if(a>d && b>e && c>f){
printf("A\n");
}
else if(b>e && c>f){
printf("A\n");
}
else if(a>d && c>f){
printf("A\n");
}
else if(a>d && b>e){
printf("A\n");
}
else{
printf("B\n");
}
}
return 0;
}