-
Notifications
You must be signed in to change notification settings - Fork 4
/
P10_RageExpenses.cs
50 lines (44 loc) · 1.53 KB
/
P10_RageExpenses.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
namespace P10_RageExpenses
{
using System;
class P10_RageExpenses
{
static void Main(string[] args)
{
int lostGames = int.Parse(Console.ReadLine());
double headsetPrice = double.Parse(Console.ReadLine());
double mousePrice = double.Parse(Console.ReadLine());
double keyboardPrice = double.Parse(Console.ReadLine());
double displayPrice = double.Parse(Console.ReadLine());
int headsetCount = 0;
int mouseCount = 0;
int keyboardCount = 0;
int displayCount = 0;
for (int i = 1; i <= lostGames; i++)
{
bool isHeadsetTrashed = false;
bool isMouseTrashed = false;
if (i % 2 == 0)
{
isHeadsetTrashed = true;
headsetCount++;
}
if (i % 3 == 0)
{
isMouseTrashed = true;
mouseCount++;
}
if (isHeadsetTrashed && isMouseTrashed)
{
keyboardCount++;
if (keyboardCount % 2 == 0)
{
displayCount++;
}
}
}
double expenses = (headsetCount * headsetPrice) + (mouseCount * mousePrice) + (keyboardCount * keyboardPrice) + (displayCount * displayPrice);
Console.WriteLine($"Rage expenses: {expenses:F2} lv.");
}
}
}