You are viewing a single comment's thread. Return to all comments →
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ map mp; int i, nums, op, val; string key;
cin >> nums; for (i = 0; i < nums; i++) { cin >> op >> key; if (op == 1) { cin >> val; mp[key] += val; } else if (op == 2) mp.erase(key); else if (op == 3) { if (mp.find(key) != mp.end()) cout << mp[key] << endl; else cout << 0 << endl; } } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Maps-STL
You are viewing a single comment's thread. Return to all comments →
include
include
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
map mp; int i, nums, op, val; string key;
}