1、CF #371 (Div. 2) C. Sonya and Queries map应用,也可用trie
2、总结:一开始直接用数组遍历,果断T了一发
题意:t个数,奇变1,偶变0,然后与问的匹配。
#include<bits/stdc++.h>
#define max(a,b) a>b?a:b
#define F(i,a,b) for (int i=a;i<=b;i++)
#define mes(a,b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;
const int N=,MAX=; LL cal(LL m)
{
int k=;
LL sum=;
while(m){
if((m%)&){
sum+=(<<k);
}
m/=;
k++;
}
return sum;
} int main()
{
map<LL,int>num;
int t;
LL m,ans;
char str[];
while(~scanf("%d",&t))
{
while(t--){
scanf("%s%lld",str,&m);
if(str[]=='+'){
ans=cal(m);
if(!num.count(ans)){
num[ans]=;
}
num[ans]++;
}
else if(str[]=='-'){
ans=cal(m);
num[ans]--;
}
else if(str[]=='?'){
ans=cal(m);
printf("%d\n",num[ans]);
}
}
} return ;
}