暑假练习赛 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 ...
随机推荐
- Apache Spark 2.2.0 中文文档 - SparkR (R on Spark) | ApacheCN
SparkR (R on Spark) 概述 SparkDataFrame 启动: SparkSession 从 RStudio 来启动 创建 SparkDataFrames 从本地的 data fr ...
- SpringBoot文档翻译系列——29.SQL数据源
原创作品,可以转载,但是请标注出处地址: 因为需要使用到这方面内容,所有对这一部分进行了翻译. 29 使用SQL数据源 SpringBoot为SQL数据源提供了广泛支持,从直接使用JdbcTempl ...
- 使用 Dawn 构建 React 项目
开发一个 React 项目,通常避免不了要去配置 Webpack 和 babel 之类,以支持 commonjs 或 es 模块及各种 es 新语法,及及进行 jsx 语法的转义.当然也可以用 cre ...
- Java数据结构和算法总结-数组、二分查找
前言:在平时开发中数组几乎是最基本也是最常用的数据类型,相比链表.二叉树等又简单很多,所以在学习数据和算法时用数组来作为一个起点再合适不过了.本篇博文的所有代码已上传 github ,对应工程的 ar ...
- vscode 调试.net core 2.0 输出乱码解决方法
之前在vscode上调试.net core 2.0项目时输出窗口一直是乱码,查了很多资料无法解决 最终在github找到了解决办法 -> https://github.com/OmniSha ...
- 消息队列、OSS常用操作封装
public class MessageQueue { #region Private Properties private const string _accessKeyId = "&qu ...
- sqlserver游标使用和循环
/*** 游标的使用 讲了这个多游标的优点,现在我们就亲自来揭开游标的神秘的面纱. 使用游标的顺序: 声名游标.打开游标.读取数据.关闭游标.删除游标. 1.3.1声明游标 最简单游标声明:DECLA ...
- wpf中内置资源文件
wpf中包含三种文件类型 资源文件:编译到可执行或库 WPF 程序集中的数据文件. 内容文件:与可执行 WPF 程序集具有显式关联的独立数据文件. 源站点文件:与可执行 WPF 程序集没有关联的独立数 ...
- 第六章 JDBC
第一章 JDBC 一.JDBC的简介 1.什么是JDBC JDBC是java数据库连接(java database connectivity)技术的简称,它充当了java应用程序与各个不同数据库之间进 ...
- cocos2dx - 环境配置,项目创建
准备工具 cocos2dx当前最新版本:v3.9 官网下载地址: http://www.cocos.com/download/ python 2.7x最新版本:2.7.11 官 ...