-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
33 lines (25 loc) · 877 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
using System;
namespace Chocolate_Feast {
class Program {
public static int ChocolateFeast(int n, int c, int m) {
int chocolate = n / c;
if (chocolate % (m - 1) == 0) {
chocolate += (chocolate / (m - 1)) - 1;
} else {
chocolate += (chocolate / (m - 1));
}
return chocolate;
}
static void Main(string[] args) {
int t = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < t; i++) {
string[] ncm = Console.ReadLine().Split(' ');
int n = Convert.ToInt32(ncm[0]);
int c = Convert.ToInt32(ncm[1]);
int m = Convert.ToInt32(ncm[2]);
int result = ChocolateFeast(n, c, m);
Console.WriteLine(result);
}
}
}
}