-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwostar_day1.cpp
More file actions
49 lines (40 loc) · 804 Bytes
/
twostar_day1.cpp
File metadata and controls
49 lines (40 loc) · 804 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
// 3 4
// 4 3
// 2 5
// 1 3
// 3 9
// 3 3
// cardinalidad
// 3 3 - 9
// 4 1 - 4
// 2 0 - 0
// 1 0 - 0
// 3 3 - 9
// 3 3 - 9
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<long int> vizq = {};
vector<long int> vder = {};
// sort( <inicio_de_la_serie>, <final_de_la_serie>)
int main(){
long int left = 0;
long int right = 0;
long int res = 0;
while(cin >> left >> right){
vizq.push_back(left);
vder.push_back(right);
}
for(int i = 0; i < vizq.size(); i++){
long int temp = 0;
for(int j = 0; j < vder.size(); j++){
if(vizq[i] == vder[j]){
temp++;
}
}
res += (temp * vizq[i]);
}
cout << res << endl;
return 0;
}