-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
35 lines (26 loc) · 909 Bytes
/
Program.cs
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
using System;
namespace Halloween_Sale {
class Program {
public static int HowManyGames(int p, int d, int m, int s) {
int numberOfGames = 0;
while (s > 0 && (s - p) >= 0) {
numberOfGames++;
s -= p;
if ((p - d) > m) {
p -= d;
} else {
p = m;
};
}
return numberOfGames;
}
static void Main(string[] args) {
string[] firstMultipleInput = Console.ReadLine().TrimEnd().Split(' ');
int p = Convert.ToInt32(firstMultipleInput[0]);
int d = Convert.ToInt32(firstMultipleInput[1]);
int m = Convert.ToInt32(firstMultipleInput[2]);
int s = Convert.ToInt32(firstMultipleInput[3]);
Console.WriteLine(HowManyGames(p, d, m, s));
}
}
}