1. 1的数量 × 0的数量 + 1。数据类型用 long long int,过了95%。2. 瞪眼法,找不同,写一串 if else。3. 看了好多解法都是 tire。我太菜了直接用哈希模拟做的。 if (op == 1) { hash[x]++; } else if (op == 2) { if (--hash[x] == 0) { hash.erase(x); } } else { long long int ret = -1; for (const auto& [a, b] : hash) { ret = max(ret, a ^ x); } } 复杂度O(n2),C++没超时。