You are viewing a single comment's thread. Return to all comments →
//M.Kohaku
using namespace std;
int main(){ int truyvan,diem; mapdiemthisinh; string ten; int n; cin >> n; for(int i=0;i> truyvan; if(truyvan==1){ cin >> ten >> diem; diemthisinh[ten] += diem; } else if(truyvan==2){ cin >> ten; diemthisinh.erase(ten); } else if(truyvan==3){ cin >> ten; if(diemthisinh.find(ten)!=diemthisinh.end()){ cout << diemthisinh[ten] << endl; } else cout << 0 << endl; } } }
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 →
//M.Kohaku
include
using namespace std;
int main(){ int truyvan,diem; mapdiemthisinh; string ten; int n; cin >> n; for(int i=0;i> truyvan; if(truyvan==1){ cin >> ten >> diem; diemthisinh[ten] += diem; } else if(truyvan==2){ cin >> ten; diemthisinh.erase(ten); } else if(truyvan==3){ cin >> ten; if(diemthisinh.find(ten)!=diemthisinh.end()){ cout << diemthisinh[ten] << endl; } else cout << 0 << endl; } } }