I seem to be getting the same output as illustrated in the output example of problem but spoj keeps telling me it's wrong answer.
Output :
1
2
-1
3
I realized it as:

printf("%d\n", n);

Will SPOJ tell me it's wrong answer if I have empty row after the last number (see in code) and they don't?
Or maybe they have additional examples which my code doesn't pass? frowning

  • created

    Apr '13
  • last reply

    Apr '13
  • 1

    reply

  • 147

    views

  • 2

    users

Your output method is fine. SPOJ doesn't usually care about white space in the output unlike some other judges.

Your assumption that there are other test cases is correct. Your code should correctly handle every input that matches the input constraints given in the problem statement. Please note that you don't have to verify that the input constraints are correct. If they are wrong there will typically be plenty of comments below the problem stating this.

Please don't hesitate to post back if you have more questions. A useful piece of information is the problem code when posting any topic. It makes it easier for us to know what you're talking about.

Cheers,
Leppy

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 14 7d

Want to read more? Browse other topics in C and C++ or view latest topics.