Sicily 6136. Windows

6136. Windows

Constraints

Time Limit: 1 secs, Memory Limit: 256 MB

Description

Now that spring is here and the sun is shining bright, people are starting to lower their blinds. ?tefica is an elderly woman who likes to keep track of what other people in the neighbourhood are doing and then talk about it behind their backs. This year, she is particularly interested in who is lowering blinds in the building across the street, and how low are they lowering them.
We will represent each window with a 4 x 4 grid, with asteriskes representing lowered blinds. ?tefica can see a window in one of the following 5 states:

The building across the street has N windows at each of the M floors. Given the current building state, find out how many windows are in each of the 5 states shown above.

 

Input

The first line of input contains space separated integers M and N (1 ≤ M, N ≤ 100).
The following lines describe the current building state. Each window is represented with one of the 4 x 4 grids shown above, and windows are separated using character ?#?. See the example input for clarification. Building description will have exactly 5M + 1 lines each having 5N + 1 characters.

 

Output

Output should contain 5 space separated integers, number of windows for each type in order shown above. Sum of these numbers is M*N.

 

Sample Input

样例1:
1 2 
########### 
#....#****# 
#....#****# 
#....#....# 
#....#....# 
###########
样例2:
2 3 
################ 
#****#****#****# 
#****#****#****# 
#****#....#****# 
#....#....#****# 
################ 
#....#****#****# 
#....#****#....# 
#....#....#....# 
#....#....#....# 
################

Sample Output

样例1:
1 0 1 0 0
样例2:
1 1 2 1 1

Problem Source

COCI 2012.4 2012年每周一赛第十一场

// Problem#: 6136
// Submission#: 2811354
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
#include <stdio.h>
#include <string.h>

char temp[5][501];
int num[5];

void judge(int col) {
    int counter = 0;
    for (int i = 1; i <= 4; i++) {
        if (temp[i][col] == '*') {
            counter++;
        }
    }
    num[counter]++;
}

int main() {
    int h, w;
    scanf("%d %d\n", &h, &w);
    memset(num, 0, sizeof(num));
    while (h--) {
        for (int i = 0; i < 5; i++) {
            gets(temp[i]);
        }
        for (int i = 0; i < w; i++) {
            judge(i * 5 + 1);
        }
    }
    for (int i = 0; i < 5; i++) {
        if (i)
            printf(" ");
        printf("%d", num[i]);
    }
    printf("\n");
    return 0;
}                     


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值