Add FZOI Codes

This commit is contained in:
2024-06-26 22:14:00 +08:00
parent 8f564ca60e
commit b80791cfad
49 changed files with 1653 additions and 0 deletions

View File

@ -0,0 +1,42 @@
#include <bits/stdc++.h>
#define int long long
using namespace std;
void f(vector<vector<int>> &vt, int n)
{
if (n == 1)
{
vt[0][0] = 0;
return;
}
int m = n / 2;
f(vt, m);
for (int i = 0; i < m; ++i)
{
for (int j = 0; j < m; ++j)
{
vt[i][j + m] = vt[i][j] + m;
vt[i + m][j] = vt[i][j + m];
vt[i + m][j + m] = vt[i][j];
}
}
}
signed main()
{
int m;
cin >> m;
int n = pow(2, m);
vector<vector<int>> vt(n, vector<int>(n));
f(vt, n);
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
cout << vt[i][j] + 1 << " ";
}
cout << endl;
}
return 0;
}