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
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 |
댓글