Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define all(v) v.begin(), v.end()
- #define forsn(i, s, n) for(int i=s;i<int(n);i++)
- #define forn(i, n) forsn(i, 0, n)
- typedef long long tint;
- int main(){
- int tc; cin >> tc;
- while(tc--){
- int n; cin >> n;
- vector<int> c (258, 0);
- forn(i, n){
- char a; int x; cin >> a >> x;
- c[(int)(a)] = x;
- }
- int m; cin >> m;
- long long cost = 0;
- m++;
- string s;
- while(m--){
- getline(cin, s);
- forn(i, int(s.size())){
- cost+=c[(int)(s[i])];
- }
- }
- cout << fixed << setprecision(2) << cost/100.0 << "$" << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement