rajutsav1234's blog

By rajutsav1234, history, 5 weeks ago, In English

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.

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

»
5 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

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.

  • »
    »
    5 weeks ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    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.

    • »
      »
      »
      5 weeks ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      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