WA in HELLO HELLO.

i submitted two versions of the same algorithm for this question.Problem Code:http://www.codechef.com/problems/HELLO/.
My 2 solutions are:
1) http://www.codechef.com/viewsolution/4171717
2) http://www.codechef.com/viewsolution/4171689. The first solution is giving wrong answer while the second one is getting accepted even though both perform the same function with a slight difference in implementation.can someone clarify???

In the first solution u are not initializing ans to zero every time . If you do so that will also be AC . Here is the code : http://www.codechef.com/viewsolution/4171772

oh!!that was careless on my part,and thanks for pointing out the mistake.

Yes both have same functionality,

We have to find the max value of m=d-((r * u)+(c/m));

Which can also be done by finding the minimum value of ((r * u)+(c/m))


Now, here's the mistake:
**Just assign ans=0; for each test case.**
Here's the link to the corrected solution:
http://www.codechef.com/status/HELLO,pratku123

Cheers

Welcome . If you find my answer useful please upvote and accept it .