MickyOr's blog

By MickyOr, history, 9 years ago, In English

I was having trouble with this problem: 584B - Коля и Таня, after a lot of trying I finally gave up, read the tutorial and found out that my solution was right. Confused, I tried a lot of stuff and rewrote my code several times but I couldn't get trough the same test case every time, then I changed the library from bits/stdc++.h to iostream and it worked! I sent it and finally got AC :D I couldn't believe that it was because of that, so I sent the same code with bits/stdc++.h and got WA. Here are those submissions: 14429081, 14429091

Why does that happen? Should I stop using bits/stdc++.h?

EDIT: sorry, It was a silly mistake :P

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

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

It happens because pow function is already defined on math.h that is included by bits/stdc++.h

So, if you try to print pow(3, 3*n) you will get a floating point value since it did not use your pow function.

So just rename your function and it should work.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Oh man, I feel so naive for not thinking about that before haha

    Thank you! :)