From 22825345250954c15a1127353dc3766e5fd274d4 Mon Sep 17 00:00:00 2001 From: pvkyt5ngb Date: Mon, 6 Nov 2023 18:59:29 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=E7=AC=AC=E4=B8=80=E9=A2=98.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 第一题.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 第一题.c diff --git a/第一题.c b/第一题.c new file mode 100644 index 0000000..a1247df --- /dev/null +++ b/第一题.c @@ -0,0 +1,34 @@ +#include + +void print_sudoku(int sudoku[9][9]) { + for (int i = 0; i < 9; i++) { + if (i % 3 == 0 && i != 0) { + printf("-------------------------\n"); + } + for (int j = 0; j < 9; j++) { + if (j % 3 == 0 && j != 0) { + printf("| "); + } + printf("%d ", sudoku[i][j]); + } + printf("\n"); + } +} + +int main() { + int sudoku[9][9] = { + {5, 3, 0, 0, 7, 0, 0, 0, 0}, + {6, 0, 0, 1, 9, 5, 0, 0, 0}, + {0, 9, 8, 0, 0, 0, 0, 6, 0}, + {8, 0, 0, 0, 6, 0, 0, 0, 3}, + {4, 0, 0, 8, 0, 3, 0, 0, 1}, + {7, 0, 0, 0, 2, 0, 0, 0, 6}, + {0, 6, 0, 0, 0, 0, 2, 8, 0}, + {0, 0, 0, 4, 1, 9, 0, 0, 5}, + {0, 0, 0, 0, 8, 0, 0, 7, 9} + }; + + print_sudoku(sudoku); + + return 0; +}