MARBLES ques got ac on HackerBlocks but not on Spoj

Getting wrong on Spoj.https://ide.codingblocks.com/#/s/14679

Your code is absolutely correct ( just change your cout << ans << " " to cout << ans << "\n" ). Actually, for this problem, the evaluation on SPOJ is kinda weird ( like it gives AC on doing ans=ans* and WA on ans*= ) . So no need to panic.

1 Like

I did that also but it didn’t work.edited version

I did that also but it didn’t work.edited version

As I told you, they have a very strict and irrational judgement for this problem ( you can read it in the comments in spoj ). I tested your code and for all cases, it gave the correct answer. So your code is correct :+1:

1 Like