## CCC '00 J3 - Slot Machines

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 16M

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 quarters every time it is played; the second machine pays quarters every time it is played; the third pays quarters every 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 ), 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

48
3
10
4

#### Sample Output

Martha plays 66 times before going broke.

• alirezaazimitabrizi  commented on Feb. 16, 2019, 1:13 p.m.

I don't know why but I get the third case wrong for some reason.

• Arihan10  commented on Jan. 17, 2019, 12:03 p.m.

Does anyone know how I can make my code faster? https://dmoj.ca/submission/1199240.

Thanks.

• magicalsoup  commented on Jan. 17, 2019, 12:55 p.m.

your logic just isn't right, you should debug your code yourself and try for at least a couple of hours before posting a comment

• NathanHuang  commented on Oct. 9, 2018, 8:26 a.m.

What does TLE mean?

• Laurak121  commented on Nov. 2, 2018, 8:10 p.m.

It means time limit exceeded. Your program probably took too long to run.

• Jan  commented on Oct. 9, 2018, 11:57 a.m.

The status codes are explained at https://dmoj.ca/about/codes/

• Lemonsity  commented on Sept. 14, 2018, 10:05 a.m. edit 2

My program runs fine for the first four question, but on question five, my program returns 5718 times. I know that is probably wrong, given how big the number is. Can anyone help me? https://dmoj.ca/src/1005564 The program isn't that efficient yet, but I just want to get it working for now.

• Rimuru  commented on Sept. 14, 2018, 12:20 p.m.

Your error is when the slots repeat (1st slot 35th time, 2ndd slot 100th time, 3rd slot 10th time)

• 1015449  commented on April 5, 2018, 8:45 a.m.

My code works and I feel like it should be fast enough but the 5th test is still running too slow, any suggestions to make it faster

• JJ_G4M3R  commented on Nov. 26, 2017, 6:34 p.m. edit 5

I keep getting 0 on 2000 questions. Even though I tested my code before I submit, the output starts cutting off every time. Why is this happening?

Example) This is what my clipped output looks like:

How many quarters does Martha have in the jar? How many times ha

• Xyene  commented on Nov. 26, 2017, 6:43 p.m.

...implies your output will be clipped when displayed on the site, specifically to 64 characters.

• JJ_G4M3R  commented on Nov. 26, 2017, 6:53 p.m.

What am I getting wrong in the questions then?

• aeternalis1  commented on Nov. 26, 2017, 6:57 p.m.

The judge looks for exact matching output, and so you should remove or comment out input prompts. Follow the output specification.

• JJ_G4M3R  commented on Nov. 26, 2017, 7:08 p.m.

Okay, thank you. I was doing it to Waterloo's formatting.

• CarlZCoc  commented on July 16, 2017, 9:13 p.m.

I think my code is good, but the second test run isn't working. My code outputs 38? Does anyone else have a similar problem

• Dordor1218  commented on Feb. 4, 2018, 6:15 p.m.

I feel like my program is good but the last test run is wrong?

• wleung_bvg  commented on July 16, 2017, 9:30 p.m.

You rotate the machine immediately so the 2nd machine is the machine Martha goes to at the start. Instead, you should rotate the machine after the first round so that the 1st machine is the machine Martha goes to at the start.

• nikos  commented on Sept. 29, 2017, 7:21 p.m.

What do you mean "rotate"?