Advertisement
noshin98

uva 11340

Feb 6th, 2017
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. long int kase,c,val,line,i,j,k,len,n[200];
  6. double price;
  7. char text[10000],x[200];
  8. while(scanf("%ld\n",&kase)==1)
  9. {
  10. for(k=1;k<=kase;k++)
  11. {
  12. price=0;
  13. scanf("%ld\n",&val);
  14. for(j=1;j<=val;j++)
  15. {
  16. scanf("%c%ld\n",&x[j],&n[j]);
  17. }
  18. scanf("%ld\n",&line);
  19. for(j=1;j<=line;j++)
  20. {
  21. gets(text);
  22. len=strlen(text);
  23. for(i=1;i<=val;i++)
  24. {
  25. for(c=0;c<len;c++)
  26. {
  27. if(x[i]==text[c])price+=n[i];
  28. }
  29. }
  30. }
  31. printf("%.2lf$\n",price/100);
  32. }
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement