Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- ue5
- 알고리즘
- 백준
- 자료구조
- DFS
- 수학
- VR
- 시뮬레이션
- 구현
- 재귀
- 브루트포스
- 그리디 알고리즘
- Unreal Engine 5
- 우선순위 큐
- 스택
- 유니티
- 트리
- 백트래킹
- 투 포인터
- c++
- BFS
- 다이나믹 프로그래밍
- Team Fortress 2
- 그래프
- 누적 합
- 정렬
- 다익스트라
- 문자열
- XR Interaction Toolkit
- 유니온 파인드
Archives
- Today
- Total
1일1알
백준 2799번 블라인드 C++ 본문
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 << " ";
}
'알고리즘' 카테고리의 다른 글
백준 2508번 사탕 박사 고창영 C++ (0) | 2023.05.04 |
---|---|
백준 3060번 욕심쟁이 돼지 C++ (0) | 2023.05.03 |
백준 4108번 지뢰찾기 C++ (0) | 2023.04.30 |
백준 23843번 콘센트 C++ (0) | 2023.04.29 |
백준 5464번 주차장 C++ (0) | 2023.04.28 |