暑假练习赛 007 C - OCR
Description
Statements
Optical Character Recognition (OCR) is one of the most famous fields of Artificial Intelligence. The main purpose of OCR is to recognize printed text (or handwriting) and convert it to the machine encoded-text. You may have seen similar applications in your smartphone: you use your camera to take a photo that contains text, then, the text is translated or saved in PDF, for example. In this problem we deal with a very limited case of OCR. You have a scanned character which is either ‘0’ (number zero) or ‘8’ (number eight) and you have to decide what number it is. The input will be an image that contains exactly one character (It is guaranteed that this character is either ‘0’ or ‘8’). The image has 2 colors: white (represented with dot ‘.’) and black (represented with asterisk ‘*’). For simplicity, the borders of the image are always white. It’s also guaranteed that black lines inside the image are either vertical or horizontal. So you may safely assume that the shapes of ‘0’ and ‘8’ inside the image are the same as their shapes in digital clocks. However, they might be stretched or not positioned in the center of the image.
Input
The first line will be the number of test cases T (T<100). Each test case starts with two positive integers (n,m) denoting the dimensions of the image. (n,m < 20). Each of the following n lines contains m values which represent the image.
Output
For each test case, print one line which contains the number of the test case, and the recognition result: ‘Zero’ or ‘Eight’. See the samples and follow the output format.
Sample Input
3
8 10
..........
..*****...
..*...*...
..*...*...
..*****...
..*...*...
..*****...
..........
6 10
..........
..*****...
..*...*...
..*...*...
..*****...
..........
10 7
.......
.......
.......
.......
..****.
..*..*.
..****.
..*..*.
..****.
.......
Case 1: Eight
Case 2: Zero
Case 3: Eight
/*
给你一个字符矩阵让你判断里面*组成的团是8还是0 只需要判断有几条横杠就行了,三条就是8,两条就是0
*/
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
#define N 25
using namespace std;
int main()
{
//freopen("in.txt","r",stdin);
int t,n,m;
char ch[N][N];
scanf("%d",&t);
for(int l=;l<=t;l++)
{
int s=;
scanf("%d%d",&n,&m);
getchar();
for(int i=;i<n;i++)
{
scanf("%s",&ch[i]);
for(int j=;j<m;j++)
{
if(ch[i][j]=='*'&&ch[i][j+]=='*'&&ch[i][j+]=='*')
{
s++;
break;
}
}
}
//cout<<s<<endl;
if(s>)
printf("Case %d: Eight\n",l);
else
printf("Case %d: Zero\n",l);
}
return ;
}
暑假练习赛 007 C - OCR的更多相关文章
- 暑假练习赛 007 E - Pairs
E - Pairs Description standard input/outputStatements In the secret book of ACM, it’s said: “Glory f ...
- 暑假练习赛 007 B - Weird Cryptography
Weird Cryptography Description standard input/outputStatements Khaled was sitting in the garden unde ...
- 暑假练习赛 007 A - Time
A - Time Description standard input/outputStatements A plane can go from city X to city Y in 1 hour ...
- 暑假练习赛 003 F Mishka and trip
F - Mishka and trip Sample Output Hint In the first sample test: In Peter's first test, there's on ...
- 暑假练习赛 003 B Chris and Road
B - Chris and Road Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144K ...
- 暑假练习赛 003 A Spider Man
A - Spider Man Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144KB ...
- 暑假练习赛 006 B Bear and Prime 100
Bear and Prime 100Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:262144KB ...
- 暑假练习赛 006 E Vanya and Label(数学)
Vanya and LabelCrawling in process... Crawling failed Time Limit:1000MS Memory Limit:262144KB ...
- 暑假练习赛 006 A Vanya and Food Processor(模拟)
Description Vanya smashes potato in a vertical food processor. At each moment of time the height of ...
随机推荐
- 【Kafka】
KafkaProducer Kafka消息发布客户端. 线程安全,跨线程共享单个生产者实例通常比拥有多个实例的速度更快. 例子,使用生产者发送包含序列号的字符串作为键/值对的记录: Propertie ...
- Webx项目的获取与验证
在JavaWeb环境配置后就可进行Webx实例项目的获取与研读了. 1.创建一个初始的Demo工程. 1)下载 Webx Maven 项目的目录结构Artifact插件. archetype-webx ...
- angular学习-01,使用第三方库(jquery...)
开发环境(window) 1.安装node https://nodejs.org/en/ 2.安装angular-cli npm install -g @angular/cli 3.使用ng new ...
- 用html+css+js做打地鼠小游戏
html 代码 first.html <!DOCTYPE html> <html lang="en"> <head> <meta char ...
- sqlDependency监控数据库数据变化,自动通知
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Linux用户角色划分
在Linux系统中,用户是分角色的,角色不同,对应权限不同.用户角色通过UID和GID识别. 大致分为三种:超级用户,普通用户,虚拟用户. 超级用户:默认是root用户,其UID和GID都是0.roo ...
- DevOps教程
唠叨话 关于德语关我屁事与靠计算逼哥数据,知识点的教学教程. 先简要搭建知识点框架:后逐步完善知识点内容.(暂时提供知识点,大部分未完善,持续更新中.) 注:第一版本,结束于2017年10月18日.其 ...
- vmware虚拟机安装CentOS-6.5教程
linux是企业最常用的服务器系统之一,CentOS是免费的,所以用的企业也挺多,今天给大家分享怎么在自己电脑的虚拟机中安装CentOS-6.5,以便用来玩耍,没事的时候可以学学linux的一些知识. ...
- 吾八哥学Python(三):了解Python基础语法(上)
学习一门开发语言首先当然是要熟悉它的语法了,Python的语法还算是比较简单的,这里从基础的开始了解一下. 标识符1.第一个字符必须是字母表中字母或下划线'_'.2.标识符的其他的部分有字母.数字和下 ...
- 微信小程序倒计时
今天做程序要做个限时抢购的功能如图: 先上代码: 源码 index.wxml 可根据自己实际需求改改 <view class="div-content-warp"> ...