Team Formation---zoj3870(异或)】的更多相关文章

题意:给定N个数,求这N个数中满足A ⊕ B > max{A, B})的AB有多少对.(A,B是N中的某两个数) 分析: 1.异或,首先想到转化为二进制. eg:110011(A)和 1(B)--------A中从右数第三个数是0,若某个数B(eg:110,101,111,……)从左向右数第三个数为1,那么两个异或一定满足A ⊕ B > max{A, B}). 还有哪些数B能让A ⊕ B > max{A, B})呢? 根据上述,同理,从右数第四个为1的数B也符合要求. 很容易想到,将N个…
/** Author: Oliver ProblemId: ZOJ3870 Team Formation */ /* 思路 1.异或运算,使用^会爆,想到二进制: 2.我们可以试着从前往后模拟一位一位的^那么只要当前位结果变大便是: 3.一般我们如何利用二进制呢?既然要爆那我们就存1的位置: 4.问题是怎么存,如何用? 5.我之前想的是每个数的每位1都存,但是那样造成的重复计算还没想出怎么避免.看了一下别人的博客,再尝试把每位数的最高位1存起来. 6.想想为什么是存最高位呢: 7.那好,现在是不…
题目传送门 /* 题意:找出符合 A^B > max (A, B) 的组数: 位运算:异或的性质,1^1=0, 1^0=1, 0^1=1, 0^0=0:与的性质:1^1=1, 1^0=0, 0^1=0, 0^0=0: 假设A < B,一定要满足B的最高位对应A的值是0,这样才可能>B(即0^1=1): 然后比赛时假设A的极限是类似0111111的情况,最后假设有误: 题解是先把每个数最高位(1)的位置统计个数,1<<4 的意思是 000010000: 只要与为0,表示最高位p…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5494 The 12th Zhejiang Provincial Collegiate Programming Contest - B Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming programming contest, Edward, the…
Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level of each stud…
Team Formation For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level of each student. He has found that if two students with skill l…
Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level of each stud…
Team Formation Time Limit: 2 Seconds Memory Limit: 131072 KB For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level of each student.…
Team Formation Time Limit: 3 Seconds Memory Limit: 131072 KB For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level of each student.…
                                                B - Team Formation Description For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level…