#include <iostream>
using namespace std;
unsigned int gray2dec(unsigned int x) {
unsigned int y = x; while(x>>=1) y ^= x; return y;
}
int main() {
int N,n;
for(cin>>N;N;--N){
cin>>n; cout<<gray2dec((1<<n)-1)<<endl;
}
return 0;
}
Sunday, 22 March 2009
The 9th Zhejiang University Programming Contest I
题目在这里:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=3214
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment