I'm new here and kinda new to programming so I need some help before I can rely on myself.
I'm getting a wrong answer in this problem: http://www.spoj.com/problems/PRISMSA/ , though I think that my solution is correct.
Here is my source code:
As I got the answer I hid my source code because it was almost complete and because they say so in this post http://discuss.spoj.com/t/read-this-before-posting/2548
I've done the mathematical calculations for a and h values and then used them to calculate S and it appeared to be right for the example input.
If anyone has got an idea why my solution is considered wrong please help me.
I don't think there is a need to put my calculations here but if that helps in knowing what's wrong I'd do it.