immuntasir

Untitled

Nov 13th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. std::ios_base::sync_with_stdio(false);
  5.  
  6. int t;
  7. cin >> t;
  8. while (t--) {
  9. int ara[300] = {0};
  10. int n, in2, i;
  11. double ans = 0;
  12. char in1;
  13. cin >> n;
  14. while (n--) {
  15. cin >> in1 >> in2;
  16. ara[in1] = in2;
  17. }
  18. cin >> n;
  19.  
  20. string str;
  21. getline(cin, str);
  22. while (n--) {
  23. i=0;
  24. getline(cin, str);
  25. while (str[i]!='\0') {
  26. ans += ara[str[i]];
  27. i++;
  28. }
  29. }
  30. cout << ans/100 << "$\n";
  31. }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment