标签:des style blog http io color ar os sp
Description
Input
Output
Sample Input
1 2 3 4 78 0
Sample Output
2 4 5 8 83
Source
1 #include<cstdio> 2 #include<algorithm> 3 4 using namespace std; 5 6 int main() 7 { 8 int p,x,num1,num2; 9 10 while(1) { 11 num1=0;num2=0; 12 scanf("%d",&x); 13 if(!x) break; 14 p=x; 15 while(p>0) { 16 if(p%2!=0) num1++; 17 p>>=1; 18 } 19 while(1) { 20 x++; 21 p=x; 22 num2=0; 23 while(p>0) { 24 if(p%2!=0) num2++; 25 p>>=1; 26 } 27 if(num2==num1) { 28 printf("%d\n",x); 29 break; 30 } 31 32 } 33 } 34 35 return 0; 36 }
[POJ] 2453 An Easy Problem [位运算]
标签:des style blog http io color ar os sp
原文地址:http://www.cnblogs.com/sxiszero/p/4087545.html