博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Zoj3944 - People Counting
阅读量:5933 次
发布时间:2019-06-19

本文共 1816 字,大约阅读时间需要 6 分钟。

People Counting

Time Limit: 2 Seconds     
Memory Limit: 65536 KB

In a BG (dinner gathering) for ZJU ICPC team, the coaches wanted to count the number of people present at the BG. They did that by having the waitress take a photo for them. Everyone was in the photo and no one was completely blocked. Each person in the photo has the same posture. After some preprocessing, the photo was converted into a H×W character matrix, with the background represented by ".". Thus a person in this photo is represented by the diagram in the following three lines:

.O./|\(.)

Given the character matrix, the coaches want you to count the number of people in the photo. Note that if someone is partly blocked in the photo, only part of the above diagram will be presented in the character matrix.

Input

There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:

The first contains two integers H, W (1 ≤ H, W ≤ 100) - as described above, followed by H lines, showing the matrix representation of the photo.

Output

For each test case, there should be a single line, containing an integer indicating the number of people from the photo.

Sample Input

23 3.O./|\(.)3 4OOO(/|\\()))

Sample Output

14

Author: Lu, Yi

Source: The 13th Zhejiang Provincial Collegiate Programming Contest

统计小人个数;  泪流满面!!

#include 
#include
#define N 110char G[N][N]; int v[N][N];int n , m;using namespace std ;void check(){ for(int i=0; i< n; i++) for( int j=0; j
= 0&& a< n && b>= 0 && b < m) return true; else return false;}int main(){ int t; scanf("%d", &t); while(t--) { scanf("%d%d", &n, &m); for(int i=0; i

 

转载于:https://www.cnblogs.com/soTired/p/5426728.html

你可能感兴趣的文章
cmd.exe启动参数说明
查看>>
《随笔记录》20170310
查看>>
网站分析系统
查看>>
一站式解决,Android 拍照 图库的各种问题
查看>>
lsof命令
查看>>
从零开始来看一下Java泛型的设计
查看>>
Shell编程基础
查看>>
Shell之Sed常用用法
查看>>
3.1
查看>>
校验表单如何摆脱 if else ?
查看>>
Good Bye 2013 A
查看>>
JS敏感信息泄露:不容忽视的WEB漏洞
查看>>
让我们荡起双桨,Android 小船波浪动画
查看>>
ApacheCN 翻译活动进度公告 2019.2.18
查看>>
分布式memcached服务器代理magent安装配置(CentOS6.6)
查看>>
Create Volume 操作(Part III) - 每天5分钟玩转 OpenStack(52)
查看>>
Polar码引发舆论狂欢 5G标准远未定局
查看>>
KSImageNamed-Xcode-master
查看>>
tomcat 8.0虚拟机配置文档
查看>>
轻松实现基于Heartbeat的高可用web服务集群
查看>>