Блог пользователя carlotheboss

Автор carlotheboss, 10 лет назад, По-английски

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

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
10 лет назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

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 лет назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

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