#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<map> using namespace std; int main() { int m,n,doller; map <string,int> msi; string word; scanf("%d%d",&m,&n); while (m--) { getchar(); cin>>word>>doller; msi[word]=doller; } while (n--) { long long int points=0; while (cin>>word) { if (word==".") break; if (msi.find(word)!=msi.end()) points+=msi[word]; } printf("%lld\n",points); } return 0; }
Sunday, July 31, 2016
UVA 10295 - Hay Points Solution

Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment