ZOJ3944-People Counting
来源:互联网 发布:软件实施人员基本素质 编辑:程序博客网 时间:2024/06/05 04:22
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 <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>#include <map>#include <cmath>#include <set>#include <stack>#include <queue>#include <vector>#include <bitset>#include <functional>using namespace std;#define LL long longconst int INF = 0x3f3f3f3f;char ch[120][120];int main(){int t;scanf("%d",&t);while (t--){int n, m;scanf("%d%d", &n, &m);n += 2; m += 2;for (int i = 2; i < n; i++) scanf("%s", ch[i] + 2);int ans = 0;for (int i = 0; i < n; i++){for (int j = 0; j < m; j++){if (ch[i][j + 1] == 'O' ||ch[i + 1][j] == '/' ||ch[i + 1][j + 1] == '|' ||ch[i + 1][j + 2] == '\\' ||ch[i + 2][j] == '(' ||ch[i + 2][j + 2] == ')')ans++;}}printf("%d\n", ans);}return 0;}
- ZOJ3944-People Counting
- 【ZOJ3944 The 13th Zhejiang Provincial Collegiate Programming ContestI】【简单模拟】People Counting 照片人数统计 人
- People Counting
- ZOJ 3944People Counting
- zoj 3944 People Counting
- I People Counting
- zoj-3944-People Counting
- ZOJ-3944 People Counting
- zoj 3944 暴力 People Counting
- 浙江16年省赛 I题 People Counting
- acm/icpc 浙江省赛 People Counting
- ZOJ 3944 People Counting(模拟+暴力)
- 13届浙江省省赛 I题 People Counting
- ZOJ-3944 People Counting From 第13届浙江省赛
- ZOJ Problem Set - 3944(interesting people counting))
- ZOJ 3944People Counting(思维/技巧/模拟)
- People
- 视频里人流跟踪统计 Counting People by Tracking in Video
- CCF NOI1069 分解因数
- 自定义一个转换器
- 【其他】论文框架
- 2017.05.06 记雏鹰博客系统开工第4天。
- 外边距失效bug
- ZOJ3944-People Counting
- spring中输入输出json数据
- 重写覆盖、重载、多态几个概念的区别分析
- eclipse出现 Some characters cannot be mapped using "GBK" character encoding 错误代码的解决办法
- Huffman文件压缩
- 欢迎使用CSDN-markdown编辑器
- 数据结构简介
- (一)GCC Makefile熟悉
- codeforces 804A Find Amir