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.


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

    Clarification. If you're not getting AC but the sample input gives you the same output as the sample output:

    you have to word the out put EXACTLY like it says in the sample output. Include the sentence( string). Not just the results.

    I think this was a bad explanation because it doesn't directly explain that, which could lead a lot of people trying to change their code when it's fundamentally correct.

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

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

  • 3
    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 😛

  • 23
    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...

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

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

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


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

    What if she wins and earns more money?

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

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

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

      Then she uses the earned money on the machines.