Sorting Bank Account, spoj, WA

I am solving http://www.spoj.com/problems/SBANK/ and I don’t understand why do I keep getting WA. I have looked for solutions but I see people have solved it using maps. I am solving this problem using C, so using maps is out of question.Also, I don’t think it’ll be fun to solve this using maps. I just want to know the case that I am failing, so that I can correct it and optimize it later, if necessary.

Thank you.

code: http://ideone.com/x63tZV

Brother try this one : https://ideone.com/OJJSnd

3 Likes

Thanks a lot :slight_smile: Anyway, can you spot what was I doing wrong?

Hi dude, I could spot one error (number of zeros)


Please see this link(your code and the test case)
Your solution . It is printing extra zeros. Also, this site could be helpful to you in detecting WA’s–>
Spot Toolkit

4 Likes

Thanks a lot! :slight_smile: