【POJ2453】An Easy Problem
problem
solution
codes
#include<iostream>
using namespace std;
int main(){
unsigned int n, x;
while(cin>>n &&n){
x = n&-n;
cout<<(n+x+(n^(n+x))/x/4)<<"\n";
}
return 0;
}
#include<iostream>
using namespace std;
int main(){
unsigned int n, x;
while(cin>>n &&n){
x = n&-n;
cout<<(n+x+(n^(n+x))/x/4)<<"\n";
}
return 0;
}
选择 | ||
|