-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10709.cpp
More file actions
54 lines (52 loc) · 828 Bytes
/
10709.cpp
File metadata and controls
54 lines (52 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 10709. 기상캐스터
// 2019.05.22
// 구현
#include<iostream>
#include<string>
using namespace std;
int map[101][101];
int main()
{
int h, w;
cin >> h >> w;
// 초기화
for (int i = 0; i < h; i++)
{
for (int j = 0; j < w; j++)
{
map[i][j] = -1;
}
}
for (int i = 0; i < h; i++)
{
string s;
cin >> s;
int count = 0;
bool flag = false; // 구름이 나온지 안나온지 유무에 대한 플래그
for (int j = 0; j < s.size(); j++)
{
if (s[j] == 'c')
{
count = 0; // count 초기화
map[i][j] = 0;
flag = true; // 구름이 등장함
count++;
}
else if (flag)
{
map[i][j] = count;
count++;
}
}
}
// 결과 출력
for (int i = 0; i < h; i++)
{
for (int j = 0; j < w; j++)
{
cout << map[i][j] << " ";
}
cout << endl;
}
return 0;
}