본문 바로가기

백준

2799 블라인드

구현구현

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <bitset>

#define xx first
#define yy second
#define all(x) (x).begin(), (x).end()
#define MAXV 1000000

using namespace std;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
using iii = tuple<int, int, int>;

int     check_type(vector<string> &v, int i, int j)
{
    if (v[i][j] == '.')
        return 1;
    if (v[i + 1][j] == '.')
        return 2;
    if (v[i + 2][j] == '.')
        return 3;
    if (v[i + 3][j] == '.')
        return 4;
    return 5;
}

int     main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    vector<string> v(5 * n + 1);
    for (int i = 0; i < 5 * n + 1; i++)
        cin >> v[i];

    vector<int> count(10);
    int x = 1;
    for (int i = 0; i < n; i++)
    {
        int y = 1;
        for (int j = 0; j < m; j++)
        {
            count[check_type(v, x, y)]++;
            y += 5;
        }
        x += 5;
    }
    
    for (int i = 1; i <= 5; i++)
        printf("%d ", count[i]);

    return 0;
}

'백준' 카테고리의 다른 글

4963 섬의 개수  (0) 2020.10.31
11866 요세푸스 문제 0  (0) 2020.10.31
11947 이런 반전이  (0) 2020.10.27
14719 빗물  (0) 2020.10.25
2133 타일 채우기  (0) 2020.10.25