摘要: 1.2.6 find your present(2)hdu 2095用位运算 ^ => 1^3^7^3^1 = 7#include using namespace std; int main() { int n,s,a; while(scanf("%d",&n)&&n) { s = 0; while(n--) { cin>>a; s ^= a; } cout using namespace std; int main() { in... 阅读全文
posted @ 2013-05-12 15:54 简洁是智慧的灵魂 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 通过在网上查找,整理的:#include using namespace std; bool is_pow2(int x) //判断是否2的n次方 { x &= x-1; if(!x) return true; return false; } void Binary(int num)//十进制转二进制 { int a[32]; int i = 0; while(num) { a[i++] = (num%2)?1:0; num >>= 1; } while(--i) { cout>x; coutusingstd::cout;usingstd::cin;u... 阅读全文
posted @ 2013-05-12 00:46 简洁是智慧的灵魂 阅读(1379) 评论(0) 推荐(0) 编辑