摘要: 1 //八皇后递归解法 2 #include<iostream> 3 using namespace std; 4 int queen[9]={-1,-1,-1,-1,-1,-1,-1,-1,-1}; 5 int count=0; 6 bool available(int pointi,int po 阅读全文
posted @ 2019-04-17 16:27 M_x_j 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 常规解法 为避免死循环(负数右移补1),我们选择左移1来判断 1 int NumberOf1(int n){ 2 int count = 0; 3 unsigned int flag = 1; 4 while(flag){ 5 if(n & flag){ 6 count++; 7 } 8 flag 阅读全文
posted @ 2019-04-17 15:03 M_x_j 阅读(207) 评论(0) 推荐(0) 编辑