-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCCC00S1.cpp
More file actions
45 lines (40 loc) · 736 Bytes
/
Copy pathCCC00S1.cpp
File metadata and controls
45 lines (40 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Problem: CCC '00 S1 - Slot Machines
// Contest: DMOJ
// URL: https://dmoj.ca/problem/ccc00s1
// Memory Limit: 16 MB
// Time Limit: 1000 ms
// Ryan Liu
#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, sum = 0;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> a >> b >> c;
while (n > 0) {
if (--n >= 0) {
a++;
if (a % 35 == 0) {
n += 30;
}
sum++;
}
if (--n >= 0) {
b++;
if (b % 100 == 0) {
n += 60;
}
sum++;
}
if (--n >= 0) {
c++;
if (c % 10 == 0) {
n += 9;
}
sum++;
}
}
cout << "Martha plays " << sum << " times before going broke."
<< "\n";
}