Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int z,t,g,q;
- char f;
- string l;
- scanf("%d",&t);
- while(t--){
- scanf("%d",&z);
- int u[256]={0},v[256]={0};
- double re=0;
- while(z--){
- cin>>f>>q;
- u[(int)f]=q;
- }
- scanf("%d\n",&z);
- while(z--){
- getline(cin,l);
- for(g=0;g<256;g++)if(u[g]){
- v[g]+=count(l.begin(),l.end(),g);
- }
- }
- for(g=0;g<256;g++)if(u[g]){
- re+=(u[g]*v[g]);
- }
- printf("%.2f$\n",re/100);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement