Ad
  • Default User Avatar

    I will repeat what I said in the post just below.

    First I notice that 69 people passed the R tests.
    I will try to explain but my explanation is maybe not the best.
    Idealy when working with floats one begins by multiplying and not by dividing (you begin with the division..) to avoid multiplying the error caused by computers in divisions.
    My explanation:-)
    1.92 - 1.47 = 0.44999999999999996... (given by computers)
    (1.92 - 1.47) * 3600 = 1619.9999999999998...
    ((1.92 - 1.47) * 3600) / 20 = 80.9999999999999858 (calculated with R, for example use formatC(max(v), digits = 16, format = "f"))
    Then you take the int or the floor (because police don't want to penalize you:-) you get 80.

    In some other languages I used a tolerance of 1 but (sorry for that) not in R.
    You don't have "to use floor(round(v, 6))". Simply made the operations in good order (mmultiplication before division) and at the end take the floor; if you do like that you will find 80. I think (but I can be wrong): it is a good example of calculating in a correct way with floats). Cheers!

  • Custom User Avatar

    Fixed the test case in python.

  • Default User Avatar

    how did you bypass this ? hardcoded ?

  • Default User Avatar

    -edit-

    Sorry, double post.

  • Default User Avatar

    -edit-

    Nevermind, solved.

  • Default User Avatar

    Also had to bypass the test case. Still not fixed.