-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (41 loc) · 705 Bytes
/
main.cpp
File metadata and controls
43 lines (41 loc) · 705 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
#include <iostream>
using namespace std;
int main()
{
int m; // kol-vo tonneley
int a; // perekrestki
int size = 0; // razmer massiva (kol-vo perekrestkov)
cin >> size >> m;
int* arr = new int [size] {}; //dinam massiv s razmernostyu, ukazannoy viwe i zapolnenniy 0
m = m * 2;
for (int i = 0; i < m; i++) {
cin >> a;
if (a < 1 || a>size) {
exit(0);
}
else if (a == 1) {
arr[0]++;
}
else if (a == 2) {
arr[1]++;
}
else if (a == 3) {
arr[2]++;
}
else if (a == 4) {
arr[3]++;
}
else if (a == 5) {
arr[4]++;
}
else if (a == 6) {
arr[5]++;
}
else
arr[6]++;
}
for (int j = 0; j < size; j++)
cout << " " << arr[j];
delete []arr;
return 0;
}