+ 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

24th Jul 2021, 9:32 AM
Anikur Rahman
Anikur Rahman - avatar
17 Respuestas
+ 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
26th Jul 2021, 4:36 AM
A͢J
A͢J - avatar
+ 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
24th Jul 2021, 10:39 AM
Daljeet Singh
Daljeet Singh - avatar
+ 1
u should link the question too. idk how to find it, ive never used that web before
24th Jul 2021, 10:11 AM
arturop200
arturop200 - avatar
+ 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
24th Jul 2021, 11:01 AM
arturop200
arturop200 - avatar
+ 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.
24th Jul 2021, 11:34 AM
Anikur Rahman
Anikur Rahman - avatar
+ 1
Rupesh Kumar I did the same....You dont need to repeat my code.😑😑😑😑😑😑😑😑
24th Jul 2021, 2:34 PM
Anikur Rahman
Anikur Rahman - avatar
+ 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
26th Jul 2021, 12:35 AM
stephen muganyizi
stephen muganyizi - avatar
+ 1
A͢J you did well
26th Jul 2021, 4:37 AM
Anikur Rahman
Anikur Rahman - avatar
+ 1
A͢J Really very nice code.... And I tried this...it works fine.
26th Jul 2021, 4:38 AM
Anikur Rahman
Anikur Rahman - avatar
+ 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 :-)
26th Jul 2021, 10:49 AM
Daljeet Singh
Daljeet Singh - avatar
+ 1
Sriraam SK Yes it is accepted whice I gave out in comments https://code.sololearn.com/cFJan6SoAWIO/?ref=app
26th Jul 2021, 10:51 AM
Anikur Rahman
Anikur Rahman - avatar
24th Jul 2021, 10:52 AM
Anikur Rahman
Anikur Rahman - avatar
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
26th Jul 2021, 4:09 AM
A͢J
A͢J - avatar
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.
26th Jul 2021, 4:20 AM
Anikur Rahman
Anikur Rahman - avatar
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.
26th Jul 2021, 4:21 AM
Anikur Rahman
Anikur Rahman - avatar
- 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; }
26th Jul 2021, 5:18 AM
Sriraam SK
Sriraam SK - avatar
- 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; }
24th Jul 2021, 2:26 PM
Rupesh Kumar
Rupesh Kumar - avatar