标签:
题目:
#include<cstdio> #include<iostream> #include<iomanip> using namespace std; int main(){ int x,y,m,n,u; cin>>m>>n; cout<<(1<<m)<<" "<<(1<<n)<<endl; for(x = 0;x <= (1<<m) - 1;x++){ u = (x ^ (x >> 1))<<n;//前m位 for(y = 0;y <= (1<<n) - 1;y++){ cout<<setw(3)<<(u | (y ^ (y >> 1)))<<" ";//前m位与后面的n位合起来 } cout<<endl; } return 0; }
参见:
http://www.matrix67.com/blog/archives/266
标签:
原文地址:http://www.cnblogs.com/aiqin/p/4417460.html