Codeforces_713_A

http://codeforces.com/problemset/problem/713/A

 

将读入的数全都存为二进制,用map保存对应的个数。

 

#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#define LL __int64
using namespace std;

int main()
{
    int n;
    map<LL,LL> mp;
    cin >> n;
    while(n--)
    {
        string s;
        LL num = 0,now = 1,temp;
        cin >> s >> temp;
        while(temp)
        {
            num += temp%2*now;
            now *= 10;
            temp /= 10;
        }
        if(s == "+")    mp[num]++;
        else if(s =="-") mp[num]--;
        else
        {
            cout << mp[num] << endl;
        }
    }
    return 0;
}

 

posted @ 2016-09-14 14:20  zzzzzzzzhu  阅读(137)  评论(0编辑  收藏  举报