carlotheboss's blog

By carlotheboss, 10 years ago, In English

1B - Spreadsheet

Hi this is my first post D: , I don't understand why i keep getting WA on test 6, precisely on test "R228C494". On the judging system my program outputs "SZ228" (Wrong), but on my pc it outputs "RZ228" (Right). I am using C++ with geany... This is my code: http://pastebin.com/1JsQ67EZ

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it +9 Vote: I do not like it

The problem seems to be that you are using pow(,) function in places where comparison is present. This may lead to errors(ie. wrong output on online judge) The function prototype of pow() is as follows: double pow (double base, double exponent); It clearly returns a double and not an int.

It is always preferable not to use pow(), rather you can always alternatively perform integral multiplication required number of times. Also, slightly change your implementation in such a way that it is not even required to use pow() function :D I faced the same problem of wrong answer even when the answer was coming right on my PC. I just replaced pow() as stated above.

PS:This is my first comment! :D

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Thanks !!! Finally, after "number of graham" submissions, i got AC!!! PS: This is my first comment to comment :D