Ad
  • Default User Avatar

    this is a prime example of why floating-point numbers should never be used to represent monetary amounts. the problem is that the reference solution does 111.0 // 3.7 to calculate the total number of beers, which yields 29.0, not 30; floor(111.0 / 3.7) would yield 30.

  • Default User Avatar

    Sometimes my submission (using Python 3.11) is accepted, and sometimes the same submission fails. Here is one that failed:

    beeramid(111, 3.7)

    It reports it should be 3, but 4 (in my answer) = 111.
    It happens whether I round the cost at each step to 2 decimal places or not.

    rownum: 1
    cumulativecost: 3.7

    rownum: 2
    cumulativecost: 18.5

    rownum: 3
    cumulativecost: 51.8

    rownum: 4
    cumulativecost: 111.0

    So how is the expected answer 3 not 4? That sounds wrong to me.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Before sorting an array be sure it can be sorted.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution