Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <string>
- #include <iostream>
- using namespace std;
- int main() {
- std::ios_base::sync_with_stdio(false);
- freopen("in.txt", "r", stdin);
- freopen("out.txt", "w", stdout);
- int t;
- cin >> t;
- while (t--) {
- int ara[300] = {0};
- int n, in2, i, ans =0;
- char in1;
- cin >> n;
- while (n--) {
- cin >> in1 >> in2;
- ara[in1] = in2;
- }
- cin >> n;
- //getchar();
- string str;
- while (n--) {
- i=0;
- getline(cin, str);
- while (str[i]!='\0') {
- ans += ara[str[i]];
- i++;
- }
- }
- cout << ans/100 << ".";
- ans = ans%100;
- if (ans/10==0) cout << "0" << ans << "$\n";
- else cout << ans << "$\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment