-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10295.cpp
44 lines (43 loc) · 1.04 KB
/
10295.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<stack>
using namespace std;
int note,word,i,j,k,flag,taka;
char A[30],B[10000];
string a;
int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
while(scanf("%d %d",&word,¬e)!=EOF){
//printf("sad");
int res=0;
map<string,int>m;
vector<string>x;
for(i=1;i<=word;i++){
scanf("%s %d",A,&taka);
m[A]=taka;
x.push_back(A);
}
for(j=1;j<=note;j++){
res=0;
while(cin>>a){
//cout<<a<<endl;
if(a=="."){
//printf("asd\n");
break;
}
for(i=0;i<x.size();i++){
if(x[i]==a){
res=res+m[x[i]];
}
}
}
printf("%d\n",res);
}
}
}