728x90
반응형
#include <iostream>
using namespace std;
int main(){
int M,N;
int answer[5] = {0};
cin >> M;
cin >> N;
string arr[5*M + 1];
for(int i=0 ; i < (5*M+1) ; i++){
cin >> arr[i];
}
for(int i=0 ; i<M ; i++){
for(int j=0 ; j<N ; j++){
if( arr[1 + i*5][1 + j*5] == '.' ) answer[0]++;
else if(arr[2 + i*5][1 + j*5] == '.') answer[1]++;
else if(arr[3 + i*5][1 + j*5] == '.') answer[2]++;
else if(arr[4 + i*5][1 + j*5] == '.') answer[3]++;
else answer[4]++;
}
}
for(int i=0 ; i<5 ; i++)
cout << answer[i] << " " ;
}
https://www.acmicpc.net/problem/2799
2799번: 블라인드
첫째 줄에 M과 N이 공백으로 구분해서 주어진다. (1 ≤ M, N ≤ 100) 다음 줄에는 현재 건너편 아파트의 상태가 주어진다. 모든 창문은 문제 설명에 나온 것 처럼 4*4 그리드로 주어진다. 또, 창문과
www.acmicpc.net
728x90
반응형
'Problem Solving' 카테고리의 다른 글
1-9. Two City Scheduling (LeetCode 1029) (0) | 2021.07.07 |
---|---|
1-8. 소수 만들기 (프로그래머스 Summer/Winter coding 2018) (0) | 2021.07.07 |
1-6. Pascal's Triangle (LeetCode 118) (0) | 2021.07.07 |
1-5. Plus One (LeetCode 66) (0) | 2021.07.07 |
1-4. 평균은 넘겠지 (백준 4344) (0) | 2021.07.07 |
댓글