懂了,以后找最巧妙的写法看排行榜!
找规律,位运算实现 $2^n$
#include <iostream>
using namespace std;
int main()
{
int n;
while(cin >> n,n )
{
for(int i = 0;i < n;i ++ )
{
for(int j = 0;j < n;j ++ )
cout << (1 << i + j) <<' ';
cout << endl;
}
cout << endl;
}
}