LevinLMKwong's blog

By LevinLMKwong, history, 9 years ago, In English

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

  • Vote: I like it
  • +7
  • Vote: I do not like it

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

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 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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