-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2022-07-06.cpp
More file actions
60 lines (50 loc) · 714 Bytes
/
2022-07-06.cpp
File metadata and controls
60 lines (50 loc) · 714 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
int time[3][2];
int timeCnt(0);
int lastTime(0);
int money(0);
int truckCnt(0);
cin >> a >> b >> c;
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 2; ++j)
{
cin >> time[i][j];
if (time[i][j] > lastTime)
{
lastTime = time[i][j];
}
}
}
for (int i = 1; i <= lastTime; ++i)
{
for (int j = 0; j < 3; ++j)
{
if (time[j][0] <= i && i < time[j][1])
{
++truckCnt;
}
}
switch (truckCnt)
{
case 1:
money += a;
break;
case 2:
money += (b * 2);
break;
case 3:
money += (c * 3);
break;
default:
break;
}
truckCnt = 0;
}
cout << money << endl;
return 0;
}