diff --git a/src/week2/BOJ10709/BOJ10709_V1.cpp b/src/week2/BOJ10709/BOJ10709_V1.cpp new file mode 100644 index 0000000..e0358ad --- /dev/null +++ b/src/week2/BOJ10709/BOJ10709_V1.cpp @@ -0,0 +1,50 @@ +#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 { + time = 0; + 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