From fc7f2d691d5644bd473e58ac0187979a76cf19c1 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Thu, 28 May 2026 17:42:54 +0900 Subject: [PATCH 1/2] =?UTF-8?q?10709=20:=20=EA=B8=B0=EC=83=81=EC=BA=90?= =?UTF-8?q?=EC=8A=A4=ED=84=B0=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week2/BOJ10709/BOJ10709_V1.cpp | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/week2/BOJ10709/BOJ10709_V1.cpp diff --git a/src/week2/BOJ10709/BOJ10709_V1.cpp b/src/week2/BOJ10709/BOJ10709_V1.cpp new file mode 100644 index 0000000..add888f --- /dev/null +++ b/src/week2/BOJ10709/BOJ10709_V1.cpp @@ -0,0 +1,55 @@ +#include +using namespace std; +int sky[100][100]; +int H, W; +int main() { + + ios_base::sync_with_stdio(false); + cin.tie(NULL); + cout.tie(NULL); + + cin >> H >> W; + + for (int i = 0; i < H; i++) { + string temp; + cin >> temp; + for (int j = 0; j < W; j++) { + if (temp[j] == 'c') + sky[i][j] = 1; + else + sky[i][j] = 0; + } + } + + + int time = -1; + for (int i = 0; i < H; i++) { + for (int j = 0; j < W; j++) { + if (!sky[i][j]) { + if (time == -1) + sky[i][j] = time; + else { + time++; + sky[i][j] = time; + } + } else { + if (time != -1) { + time = 0; + sky[i][j] = time; + } else { + time++; + sky[i][j] = time; + } + } + } + time = -1; + } + + for (int i=0; i < H; i++) { + for (int j = 0; j < W; j++) { + cout << sky[i][j] << " "; + } + cout << "\n"; + } + return 0; +} \ No newline at end of file From fc12429dedf1edaa5fc15caba3e57c0ea4432709 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Thu, 28 May 2026 17:50:46 +0900 Subject: [PATCH 2/2] =?UTF-8?q?10709=20:=20=EA=B8=B0=EC=83=81=EC=BA=90?= =?UTF-8?q?=EC=8A=A4=ED=84=B0=20refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week2/BOJ10709/BOJ10709_V1.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/week2/BOJ10709/BOJ10709_V1.cpp b/src/week2/BOJ10709/BOJ10709_V1.cpp index add888f..e0358ad 100644 --- a/src/week2/BOJ10709/BOJ10709_V1.cpp +++ b/src/week2/BOJ10709/BOJ10709_V1.cpp @@ -33,13 +33,8 @@ int main() { sky[i][j] = time; } } else { - if (time != -1) { - time = 0; - sky[i][j] = time; - } else { - time++; - sky[i][j] = time; - } + time = 0; + sky[i][j] = time; } } time = -1;