//会用map真的很好
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
map <int,int> p;//这是大佬想出来的 太棒了
int zhuan(char s[])
{
int ans=0,len;
len=strlen(s);
for(int i=0;i<len;i++)
{
int n=s[i]-'0';
n=n%2;//只要奇偶一样就可以,所以对二余
ans=ans*2+n;//这个操作是为了,奇偶的操作位数(个位,十位啥的)一致
}
return ans;
}
int main()
{
int n;
char s[2],str[20];
scanf("%d",&n);
while(n--)
{
scanf("%s%s",s,str);
int tmp=zhuan(str);
if(s[0]=='+')
{
// if(p.find(tmp)!=p.end())
//{
p[tmp]++;
//}
}
if(s[0]=='-')
{
if(p[tmp]==1)
{
p.erase(tmp);
}
else
p[tmp]--;
}
if(s[0]=='?')
{
printf("%d\n",p[tmp]);
}
}
return 0;
}
林大1510
最新推荐文章于 2024-01-07 21:12:08 发布