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

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

Recently, I tried to solve problem 121C, but some weird things happened

Here is my 2 submissions

7567786 7567793

The first one gets AC, the second one gets TLE. The only difference between these 2 is in the second, i add " // " at line 77, at where the code line " cout<<" " ". Thus, if I cout<<" " at each loop, the result is OK, but if not, something happens and I get TLE. Please explain me! Thank you very much!

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

»
12 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Please explain me!

undefined behaviors all over the place. I wonder how one of this submissions got AC, it's kind of miracle

»
12 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

On line 95 you use the variable j without initializing it.

Also you should be careful with log10(), it can return imprecise floating point values, and you may not get what you expect when converting the value to int.