-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparking.cpp
63 lines (51 loc) · 863 Bytes
/
parking.cpp
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
61
62
63
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_set>
#include <ctype.h>
using namespace std;
int main()
{
long long i, j, k;
int high, low;
int parkA[101];
int parkB[101];
int parkC[101];
int prices[4] = {0,0,0,0};
int cost = 0;
for (i = 1; i < 4; i++)
{
cin >> prices[i];
}
for (i = 0; i < 101; i++)
{
parkA[i] = 0;
parkB[i] = 0;
parkC[i] = 0;
}
cin >> low >> high;
for (i = low; i < high; i++)
{
parkA[i] = 1;
}
cin >> low >> high;
for (i = low; i < high; i++)
{
parkB[i] = 1;
}
cin >> low >> high;
for (i = low; i < high; i++)
{
parkC[i] = 1;
}
for (i = 1; i < 101; i++)
{
cost += prices[parkA[i] + parkB[i] + parkC[i]] * (parkA[i] + parkB[i] + parkC[i]);
}
cout << cost << "\n";
return 0;
}