-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_party_profit
46 lines (44 loc) · 1.43 KB
/
01_party_profit
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
46
using System;
namespace demo01_party_profit
{
class Program
{
static void Main()
{
int pSize = int.Parse(Console.ReadLine());
int Days = int.Parse(Console.ReadLine());
int TotalCoins = 0;
TotalCoins += Days * 50;
for (int day = 1; day <= Days; day++)
{
if (day % 10 == 0)
{
pSize -= 2;
}
if (day % 15 == 0)
{
pSize += 5;
}
bool HaveMotivationalParty = false;
//TotalCoins += 50;
TotalCoins -= 2 * pSize;
if (day % 3 == 0)
{
TotalCoins -= pSize * 3;
HaveMotivationalParty = true;
}
if( day % 5 == 0)
{
TotalCoins += 20 * pSize;
if (HaveMotivationalParty == true)
{
TotalCoins -= pSize * 2;
}
}
HaveMotivationalParty = false;
//TotalCoins -= 2 * pSize;
}
double received = (double)TotalCoins / (double)pSize;
double receivedRounded = Convert.ToInt32(Math.Floor(received));
Console.WriteLine($"{pSize} companions received {receivedRounded} coins each.");
}