-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathM. Make Cents.cpp
48 lines (32 loc) · 934 Bytes
/
M. Make Cents.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
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main() { _
long long n;
cin >> n;
while (n--)
{
long long currency_types, number_competitiions;
cin >> currency_types >> number_competitiions;
unordered_map<string,double> currencys;
currencys["JD"] = 1;
double total = 0;
while (currency_types--)
{
double currency;
string currency_name;
cin >> currency_name >> currency;
currencys[currency_name] = currency;
}
while (number_competitiions--)
{
double value;
string currency_name;
cin >> value >> currency_name;;
total += (value * currencys[currency_name]);
}
cout << fixed;
cout.precision(6);
cout << total << '\n';
}
}