Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* BISMILLAHIR-RAHMANIR-RAHIM
- ____________________________________
- | |
- | SHANTO_SUST_SWE-19_029 |
- |____________________________________|
- */
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
- #define pb push_back
- #define Pi acos(-1)
- #define r0 return 0
- #define endl "\n"
- #define show(x) cout << x << endl
- #define take(x) cin >> x
- #define debug 1
- int main()
- {
- long long T, k, m, x, temp;
- cin >> T;
- char c;
- long long i, n, j;
- while(T--) {
- cin >> k;
- vector < long long > v(256);
- for(i = 0; i < k; i++) {
- cin >> c;
- cin >> x;
- temp = (long long)c;
- getchar();
- v[temp] = x;
- }
- cin >> m;
- getchar();
- long long sum = 0;
- for(i = 0; i < m; i++) {
- string s;
- getline(cin, s);
- n = s.size();
- for(j = 0; j < n; j++) {
- temp = (long long)s[j];
- sum += v[temp];
- }
- s.clear();
- }
- if(sum % 100 < 10) cout << sum / 100 << ".0" << sum % 100 << "$" << endl;
- else cout << sum / 100 << "." << sum % 100 << "$" << endl;
- v.clear();
- }
- r0;
- }
- //ALHAMDULILLAH
Advertisement
Add Comment
Please, Sign In to add comment