hamidrh's blog

By hamidrh, 10 years ago, In English

Hi to all sry if my English isn't good anyway at this problem B. Little Dima and Equation I tried this code my first try u can see It in test 1 ~~~~~ Input 3 2 8 Output 2 10 2008 Answer 3 10 2008 13726 Checker comment wrong answer 1st numbers differ — expected: '3', found: '2' ~~~~~

and NOW copy my code in your compiler and u can see it was correct in your pc why!!!! I tried a lot and I understood pow() in codeforces judge is ill :D

  • Vote: I like it
  • -19
  • Vote: I do not like it

»
10 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

I don't know exactly, but I think pow() uses Taylor series, and for example pow(5, 5) can be little less or more than 625. But:

(int)(625 + eps) = 625

(int)(625 — eps) = 624

round() may fix this problem.

»
10 years ago, # |
  Vote: I like it +6 Vote: I do not like it

I changed your code a bit so it gets past the first test case. However, you have not accounted for the fact that the number must be greater than 0 and less than 10^9. Thus, it still gives wrong answer on test 10.

http://codeforces.com/contest/460/submission/7574790

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    what ceil(pow(a,b))?

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    How does this work? I understand the original problem, that pow(2, 2) can be 3.999, etc. but similarly, can't it be 4.000001, which makes your code wrong?

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

      No, it can only be 3.999, etc.

      Proof is that I got the code accepted using that.

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

You can not use pow function.You must write your pow function.That is not so hard :)

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it
»
10 years ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

I'm wondering if the ill thing in here is Codeforces..

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

because U use pow !!!