We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<cmath>#include<cstdio>#include<vector>#include<iostream>#include<set>#include<map>#include<algorithm>usingnamespacestd;intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */intq;cin>>q;map<string,int>m;inttype;stringx;inty;while(q--){cin>>type;if(type==1){cin>>x>>y;m[x]+=y;}elseif(type==2){cin>>x;m.erase(x);}elseif(type==3){cin>>x;map<string,int>::iteratoritr=m.find(x);if(itr==m.end())cout<<0<<endl;elsecout<<m[x]<<endl;}}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
here is my solution.
include
include
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
}
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;
}
Here's my solution:-