1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <map> using namespace std; map<char,int> mp; int main() { int t,n,k,val; char c; cin>>t; getchar(); while(t--) { cin>>n; getchar(); mp.clear(); while(n--) { scanf("%c %d",&c,&val); getchar(); mp[c]=val; } cin>>k; getchar(); double ans=0; while(k) { c=getchar(); if(c=='\n') k--; else ans+=mp[c]; } printf("%.2lf$\n",ans/100); } return 0; } |