Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- std::ios_base::sync_with_stdio(false);
- int t;
- cin >> t;
- while (t--) {
- int ara[300] = {0};
- int n, in2, i;
- double ans = 0;
- char in1;
- cin >> n;
- while (n--) {
- cin >> in1 >> in2;
- ara[in1] = in2;
- }
- cin >> n;
- string str;
- getline(cin, str);
- while (n--) {
- i=0;
- getline(cin, str);
- while (str[i]!='\0') {
- ans += ara[str[i]];
- i++;
- }
- }
- cout << ans/100 << "$\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment