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

Автор rajutsav1234, история, 3 года назад, По-английски

I was solving problem link . My code runs fine on my other compilers. But It fails on same testcases on CF online Judge. Here is my solution link.[submission:112599418][submission:112599418] In the code, at one line I had checked if a double is integer or not. I am not able to figure out why is it happening so. Please help.

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

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

Uh i don't think its a reliable check, you should check against floor as well. ceil(1+1e-10)=2. Inconsistency is probably caused by excess precision which is enabled by default on 32 bit mingw.

  • »
    »
    3 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Oh yes. Now I have changed my ceil() function to round(). And my solution is accepted.

    But still my old code link was able to pass first testcase on other compiler but fail on online judge.

    • »
      »
      »
      3 года назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      As i said most normal ppl have 64bit compilers. gnu c++17 is the 32 bit mingw version with excess precision. MinGW is such a mess idk if its a cf problem or all mingw 32 versions problem