알고리즘
백준 2799번 블라인드 C++
영춘권의달인
2023. 5. 2. 13:02
https://www.acmicpc.net/problem/2799
2799번: 블라인드
첫째 줄에 M과 N이 공백으로 구분해서 주어진다. (1 ≤ M, N ≤ 100) 다음 줄에는 현재 건너편 아파트의 상태가 주어진다. 모든 창문은 문제 설명에 나온 것 처럼 4*4 그리드로 주어진다. 또, 창문과
www.acmicpc.net
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
using namespace std;
int n, m;
vector<vector<char>> board;
vector<int> blindType(5, 0);
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n >> m;
board = vector<vector<char>>(1 + n * 5, vector<char>(1 + m * 5));
for (int i = 0; i < board.size(); i++) {
for (int j = 0; j < board[i].size(); j++) {
cin >> board[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
int row = 1 + i * 5;
int col = 1 + j * 5;
int type = 0;
for (int k = 0; k < 5; k++) {
type = k;
if (board[row + k][col] == '.') break;
}
blindType[type]++;
}
}
for (auto a : blindType) cout << a << " ";
}