题:https://ac.nowcoder.com/acm/contest/888/C
#include<bits/stdc++.h> using namespace std; const int M=2e3+3; int n,A[M][M]; void dfs(int x){ if(x==1){ A[1][1]=1; return ; } int t=x/2; dfs(t); for (int i=1;i<=t;i++) for (int j=1;j<=t;j++){ A[i+t][j]=A[i][j+t]= A[i][j]; A[i+t][j+t]=-A[i][j]; } } int main() { cin>>n; dfs(n); for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) printf("%d%c",A[i][j],j==n?' ':' '); return 0; }