Beginners problem

I am solving Beginner problems since I have started coding recently.But the problem is every time I submit my code,it says wrong answer or some error even though the output with the given input and other inputs seems correct.This becomes now so irritating and when I see the correct submissions,there’s not much difference in my code from theirs and also in some come correct submitted code,they didn’t even put constraints given in the problem,then also their code is submitted.Please tell me how to deal with all this.
I am solving in C language but thank you.

I am sharing the solution.If you could tell me where I am going wrong,it would be very helpful for me.

ATM:CodeChef: Practical coding for everyone

Enormous Input Test:https://www.codechef.com/viewsolution/24401084,https://www.codechef.com/viewsolution/24401611

add two nos:https://www.codechef.com/viewsolution/24402650,https://www.codechef.com/viewsolution/24402898

Could you share the problem link in which you are facing problem?

ATM,Enormous Input Test,Add two numbers of Beginners Practice section

ATM:- CodeChef: Practical coding for everyone
Enormous Input test :- CodeChef: Practical coding for everyone
Add two Numbers :- CodeChef: Practical coding for everyone
Even i as a beginner faced the problem with dealing those WA but be careful of the test cases as well as the Loops you take for test case they may result in error. You can refer this solutions if you need help and get it.

I am solving in C language but thank you.

I am sharing the solution.If you could tell me where I am going wrong,it would be very helpful for me.

ATM:CodeChef: Practical coding for everyone

Enormous Input Test:https://www.codechef.com/viewsolution/24401084,https://www.codechef.com/viewsolution/24401611

add two nos:https://www.codechef.com/viewsolution/24402650,https://www.codechef.com/viewsolution/24402898

For the third problem keep it till 1001 or tc<=1000 or simply use while(t–) for meeting any cases
and even the if statements are not necessary please remove them and even in 2nd problem you need a array you must set a counter and count if n is divisible by k simply as seen in my solution.
Similarly check it for 1st question

1 Like

First of all, you don’t need to write the constraints in your code. The constraints are there to tell you that the compiler will check your code between those values.So, whatever be the input is, it will be lying between those constraints.Suppose the constraints are large then you have to code so that it will give correct answer on large inputs also.
Second thing, i think you should switch to C++ because it will help you in a lot of ways.It is very similar to C just start writing code in C++. And wherever you stuck ,search the web.
Third thing is that you have to check if (x<=p-0.5) (because 0.5 will also be debited)you can withdraw the amount otherwise not.
Also, it should be divisible by 5.

2 Likes

i fixed ur code for ATM
https://www.codechef.com/submit/complete/24406703
ur code was failing in test cases like
30 30.00

  • remember there are edge cases
    if ur code gives correct output for given test cases then it doesn’t mean it correct
  • write indented code. ur code is no properly indented which makes it difficult to debug. Especially if u are asking for help then indentation is must (FYI my soln abv is not properly indented coz i coded it on mobile and still writing this on mobile)

Now I want you to identify prob in other ques by urself

1 Like

divisibility check is correct the way he did it
but its funny why he did it that way :joy:
may be he is jst checking last digit if its 0 or 5 like we do manually

2 Likes

yesss you got it…:joy:

and thank you for the support and telling my mistakes.

thank you for telling me the mistakes,means a lot to me and for the advice.:hugs:

1 Like

Thank you for the help.:hugs:

1 Like