I wrote a code for the FCTRL2 problem. Below link has the input+output sequence I get in gcc.
http : // pastebin . com / m4d152f8a
But, SPOJ says "WRONG ANSWER". What could be the reason? I'm getting the correct answer for each input in my system..
Please help!