TOPIC
It says 100% error but the code is all right all
hraarphin asked 6 years ago
#include <bits/stdc++.h>
using namespace std;
int main(){
int m, n;
scanf("%d %d", &m, &n);
map<string, double> mymap;
string str; double dbl;
for(int i = 0; i < m; i++){
cin >> str >> dbl;
mymap.insert(pair<string, double>(str, dbl));
}
getchar();
for(int i = 0; i < n; i++){
string line;
double sum = 0;
while(getline(cin, line)){
if(line == "."){
cout << sum << endl;
break;
}
stringstream ss(line);
string word;
while(ss >> word){
if(mymap.find(word) != mymap.end()){
sum = sum + mymap[word];
}
}
}
}
return 0;
}