{"trustable":false,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"任选两个数,异或大于他们两个数\u003cp\u003e\n\t\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n\t MathJax.Hub.Config({\n\t extensions: [\"tex2jax.js\"],\n\t jax: [\"input/TeX\", \"output/SVG\"],\n\t tex2jax: {\n\t inlineMath: [ [\u0027$\u0027,\u0027$\u0027], [\"\\\\(\",\"\\\\)\"] ],\n\t displayMath: [ [\u0027$$\u0027,\u0027$$\u0027], [\"\\\\[\",\"\\\\]\"] ],\n\t processEscapes: true\n\t },\n\t });\n\t\u003c/script\u003e\n\t\u003cscript type\u003d\"text/javascript\"\n\t src\u003d\"https://cdn.staticfile.org/mathjax/2.7.0/MathJax.js\"\u003e\n\t\u003c/script\u003e\n \n \u003cp\u003eFor an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from \u003cvar\u003eN\u003c/var\u003e students of his university.\u003c/p\u003e \n \u003cp\u003eEdward knows the skill level of each student. He has found that if two students with skill level \u003cvar\u003eA\u003c/var\u003e and \u003cvar\u003eB\u003c/var\u003e form a team, the skill level of the team will be \u003cvar\u003eA\u003c/var\u003e ⊕ \u003cvar\u003eB\u003c/var\u003e, where ⊕ means bitwise exclusive or. A team will play well if and only if the skill level of the team is greater than the skill level of each team member (i.e. \u003cvar\u003eA\u003c/var\u003e ⊕ \u003cvar\u003eB\u003c/var\u003e \u0026gt; max{\u003cvar\u003eA\u003c/var\u003e, \u003cvar\u003eB\u003c/var\u003e}).\u003c/p\u003e \n \u003cp\u003eEdward wants to form a team that will play well in the contest. Please tell him the possible number of such teams. Two teams are considered different if there is at least one different team member.\u003c/p\u003e \n "}},{"title":"Input","value":{"format":"HTML","content":"\u003c/h4\u003e \n \u003cp\u003eThere are multiple test cases. The first line of input contains an integer \u003cvar\u003eT\u003c/var\u003e indicating the number of test cases. For each test case:\u003c/p\u003e \n \u003cp\u003eThe first line contains an integer \u003cvar\u003eN\u003c/var\u003e (2 \u0026lt;\u003d \u003cvar\u003eN\u003c/var\u003e \u0026lt;\u003d 100000), which indicates the number of student. The next line contains \u003cvar\u003eN\u003c/var\u003e positive integers separated by spaces. The \u003cvar\u003ei\u003csup\u003eth\u003c/sup\u003e\u003c/var\u003e integer denotes the skill level of \u003cvar\u003ei\u003csup\u003eth\u003c/sup\u003e\u003c/var\u003e student. Every integer will not exceed 10\u003csup\u003e9\u003c/sup\u003e.\u003c/p\u003e \n \u003ch4"}},{"title":"Output","value":{"format":"HTML","content":"\u003c/h4\u003e \n \u003cp\u003eFor each case, print the answer in one line.\u003c/p\u003e \n \u003ch4"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003c/h4\u003e \n \u003cpre\u003e2\n3\n1 2 3\n5\n1 2 3 4 5\n\u003c/pre\u003e \n \u003ch4"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003c/h4\u003e \n \u003cpre\u003e1\n6\n\u003c/pre\u003e \n\u003cp\u003e\n题意就是有n个数,如果满足a^b \u003e MAX(a, b),就算一种组合,问n个数之间这样的组合有多少个;\u003cp\u003e\n\n 可以发现,如果要让一个数增大,只要该数化为二进制后的出现0的位置跟1异或就会变大,\n\u003cp\u003e\n 同时需要满足另一个数的最高位为该数出现0位置的位数,\n\u003cp\u003e\n 如10可以跟1异或变为11 ,100可以跟10、11、1异或分别变为110,111,101,而101只能跟两位的进行异或,\n\u003cp\u003e\n 因为它的0出现的位置为第二位,最后求和就行了。\n\u003cp\u003e\n cnt[i]代表a数组都转换成二进制数后最高位所在位置i为1的数的个数;\n \u003cp\u003e "}}]}