Advertisement
erfanul007

UVa 11340

Dec 6th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main() {
  4. long long int t;
  5. scanf("%lld",&t);
  6. while(t--) {
  7. long long int n,i;
  8. long long int val[1000]={},x,total=0;
  9. char str[10001];
  10. scanf("%lld",&n);
  11. getchar();
  12. while(n--){
  13. gets(str);
  14. sscanf(str+2,"%lld",&x);
  15. val[str[0]+128]=x;
  16. }
  17. scanf("%lld",&n);
  18. getchar();
  19. while(n--){
  20. gets(str);
  21. for(i=0;i<strlen(str);i++)
  22. total=total+val[str[i]+128];
  23. }
  24. printf("%lld.%02lld$\n",total/100,total%100);
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement