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

Автор LevinLMKwong, история, 9 лет назад, По-английски

In this problem 557B - Pasha and Tea : I got a wrong answer with this submission 11854334 But I run the same program in my pc it can return the correct answer '1000000000'.

So I left a comment and asked for help, a nice guy 'brighterstill' helped and updated my code and get accepted : 11869049

So I now have two questions, why my code is wrong and why changed to double make it right ....

Please help, thanks

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

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

i think that in th test 46 the valuse of w is very big for int; double is larger than int so it works; 'n' can be int, it doesn't matter

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

as mentioned in the comment above and you can just replace ans = a[0]*3*n with ans = 1LL*a[0]*3*n instead