异或
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
问题说明
[小雨]有一个数列a1,a2,...,an。有一天,[浩然]拿来了一个正整数X。小雨是一个特别喜欢异或(xor)运算的孩子,于是,小雨就想知道,自己能找到多少对数(i,j)能够满足ai xor aj=X。 两个数对(i1, j1)与(i2, j2)不同,当且仅当i1≠i2或者j1≠j2。
提示:异或运算在C++里的算符是^。
输入格式
第一行两个正整数n,X,分别表示数列的长度以及浩然带来的整数。
第二行包含n个正整数,表示数列an。
输出格式
一行一个整数表示答案。
5 1
1 4 2 2 5
2
样例解释
因为4 xor 5=1,所以这两个数对是(2,5)和(5,2)。
数据范围
对于50%的数据,。
对于接下来20%的数据,。
对于100%的数据,。
2024.7.26 进阶组周赛
- Status
- Done
- Rule
- IOI
- Problem
- 3
- Start at
- 2024-7-26 20:00
- End at
- 2024-7-30 20:00
- Duration
- 96 hour(s)
- Host
- Partic.
- 4