From b080d7e91de3d097f21d278d21f982ef23f36ec2 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Mon, 27 Jul 2026 15:55:32 +0900 Subject: [PATCH 1/2] =?UTF-8?q?17406=20:=20=EB=B0=B0=EC=97=B4=20=EB=8F=8C?= =?UTF-8?q?=EB=A6=AC=EA=B8=B0=204=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week5/BOJ17406/BOJ17406_V1.cpp | 85 ++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/week5/BOJ17406/BOJ17406_V1.cpp diff --git a/src/week5/BOJ17406/BOJ17406_V1.cpp b/src/week5/BOJ17406/BOJ17406_V1.cpp new file mode 100644 index 0000000..fff4299 --- /dev/null +++ b/src/week5/BOJ17406/BOJ17406_V1.cpp @@ -0,0 +1,85 @@ +#include +using namespace std; +int A[101][101]; +int N,M,C; +int rotate_input[6][3]; +int ret = INT_MAX; + +void run_rotate(int y, int x, int n){ + int temp1[101][101]; + for (int i=1; i<=n; i++) { + memcpy(temp1, A, sizeof(A)); + int top = y-i; + int bot = y+i; + int left = x-i; + int right = x+i; + vector> idx; + for (int j=left; j<=right; j++) + idx.push_back({top,j}); + for (int j=top+1; j<=bot; j++) + idx.push_back({j,right}); + for (int j=right-1; j>=left; j--) + idx.push_back({bot,j}); + for (int j=bot-1; j>top; j--) + idx.push_back({j,left}); + + int idx_size = idx.size(); + for (int j=0; j order) { + int temp1[101][101]; + memcpy(temp1, A, sizeof(A)); + for (int i=0; i> N >> M >> C; + + for (int i=1; i<=N; i++) { + for (int j=1; j<=M; j++) { + cin >> A[i][j]; + } + } + + vector permute_vec(C); + for (int i=0; i> rotate_input[i][0]; + cin >> rotate_input[i][1]; + cin >> rotate_input[i][2]; + permute_vec[i] = i; + } + + do { + solve(permute_vec); + } while(next_permutation(permute_vec.begin(), permute_vec.end())); + + cout << ret; + return 0; +} \ No newline at end of file From 9b8f997d1a2d733ca2be0cdaf0e5c6d1d74ab38e Mon Sep 17 00:00:00 2001 From: sh0723 Date: Mon, 27 Jul 2026 16:02:55 +0900 Subject: [PATCH 2/2] =?UTF-8?q?17406=20:=20=EB=B0=B0=EC=97=B4=20=EB=8F=8C?= =?UTF-8?q?=EB=A6=AC=EA=B8=B0=204=20=ED=9A=8C=EC=A0=84=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week5/BOJ17406/BOJ17406_V1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/week5/BOJ17406/BOJ17406_V1.cpp b/src/week5/BOJ17406/BOJ17406_V1.cpp index fff4299..62c5068 100644 --- a/src/week5/BOJ17406/BOJ17406_V1.cpp +++ b/src/week5/BOJ17406/BOJ17406_V1.cpp @@ -7,8 +7,8 @@ int ret = INT_MAX; void run_rotate(int y, int x, int n){ int temp1[101][101]; + memcpy(temp1, A, sizeof(A)); for (int i=1; i<=n; i++) { - memcpy(temp1, A, sizeof(A)); int top = y-i; int bot = y+i; int left = x-i; @@ -48,8 +48,8 @@ void get_min_val() { void solve(vector order) { int temp1[101][101]; memcpy(temp1, A, sizeof(A)); - for (int i=0; i