Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CCC ' 0 0 S 1 - Slot Machines View as PDF Submit solution My submissions All submissions Best submissions Voting statistics Points: 5 Time

CCC '00 S1- Slot Machines
View as PDF
Submit solution
My submissions
All submissions
Best submissions
Voting statistics
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
t
h
time it is played; the second machine pays
60
quarters every
100
t
h
time it is played; the third pays
9
quarters every
10
t
h
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
Copy
48
3
10
4
Sample Output
Copy
Martha plays 66 times before going broke.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Does the firm leverage its core competencies?

Answered: 1 week ago