Sunday, July 31, 2016

UVA 10295 - Hay Points Solution

Unknown
#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;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,