Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- long int kase,c,val,line,i,j,k,len,n[200];
- double price;
- char text[10000],x[200];
- while(scanf("%ld\n",&kase)==1)
- {
- for(k=1;k<=kase;k++)
- {
- price=0;
- scanf("%ld\n",&val);
- for(j=1;j<=val;j++)
- {
- scanf("%c%ld\n",&x[j],&n[j]);
- }
- scanf("%ld\n",&line);
- for(j=1;j<=line;j++)
- {
- gets(text);
- len=strlen(text);
- for(i=1;i<=val;i++)
- {
- for(c=0;c<len;c++)
- {
- if(x[i]==text[c])price+=n[i];
- }
- }
- }
- printf("%.2lf$\n",price/100);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement