Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main() {
- long long int t;
- scanf("%lld",&t);
- while(t--) {
- long long int n,i;
- long long int val[1000]={},x,total=0;
- char str[10001];
- scanf("%lld",&n);
- getchar();
- while(n--){
- gets(str);
- sscanf(str+2,"%lld",&x);
- val[str[0]+128]=x;
- }
- scanf("%lld",&n);
- getchar();
- while(n--){
- gets(str);
- for(i=0;i<strlen(str);i++)
- total=total+val[str[i]+128];
- }
- printf("%lld.%02lld$\n",total/100,total%100);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement