CCC '00 S1 - Slot Machines

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2000 Stage 1, Junior #3, Senior #1

Martha takes a jar of quarters to the casino with the intention of becoming rich. She plays three machines in turn. Unknown to her, the machines are entirely predictable. Each play costs one quarter. The first machine pays 30 quarters every 35^{th} time it is played; the second machine pays 60 quarters every 100^{th} time it is played; the third pays 9 quarters every 10^{th} time it is played.

Input Specification

Your program should take as input the number of quarters in Martha's jar (there will be at least one and fewer than 1000), and the number of times each machine has been played since it last paid.

Output Specification

Your program should output the number of times Martha plays until she goes broke.

Sample Input


Sample Output

Martha plays 66 times before going broke.


  • 0
    teddycitrus  commented on Feb. 19, 2024, 2:59 p.m.

    i still dont get how the last three lines of input. are they literally just the amount of times the machines were used before Martha arrived since last payout? are they the amount of times she has already used them? i wrote my code assuming the former, and i dont know whats wrong with my logic. dont know if others can view it, but heres mine:

  • 3
    Weifeng_Wang  commented on Jan. 31, 2024, 12:43 a.m.

    Well, it could be some people's life savings... Not all of us, but at least 700 million people is in absolute poverty...

    • 1
      HisMonDon  commented on Feb. 6, 2024, 11:23 p.m.


  • -7
    lilfrankster101  commented on May 20, 2023, 2:22 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

    • 6
      Xyene  commented on May 30, 2023, 2:22 a.m.

      This is the case for nearly all problems on the judge, unless stated otherwise.

  • 5
    spheniscine  commented on May 1, 2023, 11:19 a.m. edited

    Ah, competitive programming of >20 years past. Output in natural language with no indication about irrelevant details like whether you have to conjugate plurality correctly 😛

  • 33
    Qw3rt7123NobleLion  commented on March 10, 2022, 10:34 p.m.

    all of Martha's life savings are in quarters and now she spent them all...

    • -36
      jerrycui07  commented on June 22, 2022, 12:18 a.m.

      This comment is hidden due to too much negative feedback. Show it anyway.

      • 39
        960t  commented on Nov. 28, 2022, 11:50 p.m.


  • -5
    hhhhhhhhfhdgshg  commented on Dec. 10, 2021, 2:45 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

    • 8
      fernandorios  commented on March 6, 2022, 3:45 p.m.

      Rule of las Vegas. The house always wins (unless you know when to quit)

    • 10
      uselessleaf  commented on Dec. 10, 2021, 1:39 p.m.

      Then she uses the earned money on the machines.