摘要: 有两个变量a,b,不用if ?: switch或其他判断语句找出两个中比较大的int max = ((a + b) + abs(a-b)) / 2给三个整数a,b,c函数实现取三个数的中间数,不可以使用sort,整数操作尽可能少1 inline int max(int a, int b) ( ret... 阅读全文
posted @ 2015-04-19 16:27 原声 阅读(133) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int func(int x){ int count = 0; while(x){ count++; x = x & (x - 1); } return count;}int main(){ cout10011100001... 阅读全文
posted @ 2015-04-19 15:53 原声 阅读(107) 评论(0) 推荐(0)