Update Code

This commit is contained in:
liquanrun 2024-01-24 12:37:22 +08:00
parent fbb92d63ed
commit 9f7ff04c9d
2 changed files with 21 additions and 6 deletions

Binary file not shown.

View File

@ -4,13 +4,28 @@
int main() {
int n, m;
std::cin >> m;
int size = std::pow(2, m);
int size = std::pow(2, m) + 1;
int arr[size][size];
for (int i = 0; i <= size; i++) {
for (auto &j : arr[i]) {
j = 0;
}
}
for (int i = 0; i < m; i++) {
for (int j = 1 + (i * 2); j <= 2 + (i * 2); j++) {
arr[i][j] = j + (i * 2);
for (int j = 1; j <= m; j++) {
for (int k = 1; k <= m; k++) {
if (j == 1) {
arr[j + (i * 2)][k + (i * 2)] = k + (i * 2);
} else {
arr[j + (i * 2)][k + (i * 2)] = m - k + 1 + (i * 2);
}
for (int k = 1 + (i * 2); k <= 2 + (i * 2); k++) {
}
}
}
for (int i = 1; i < size; i++) {
for (int j = 1; j < size; j++) {
std::cout << arr[i][j] << " ";
}
std::cout << std::endl;
}
}