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; }