poj 2403 Hay Points

来源:互联网 发布:名创优品有淘宝店吗 编辑:程序博客网 时间:2024/05/20 20:18
#include <iostream>#include <string>#include <map>using namespace std;map<string, int> mymap;int main(){    int i, m, n, point, ans;    string str, word;    cin >> m >> n;    for (i = 0; i < m; i++){        cin >> str >> point;        mymap[str] = point;    }        for (i = 0; i < n; i++){        ans = 0;        while (cin >> word){              if (word == ".")  break;              if (mymap[word] != 0)                 ans += mymap[word];        }        cout << ans << endl;    }        system("pause");}