暑假练习赛 007 C - OCR

C - OCR

Description

standard input/output
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

Input

38 10............*****.....*...*.....*...*.....*****.....*...*.....*****.............6 10............*****.....*...*.....*...*.....*****.............10 7..............................****...*..*...****...*..*...****........

Output

Case 1: EightCase 2: ZeroCase 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=1;l<=t;l++)
    {
        int s=0;
        scanf("%d%d",&n,&m);
        getchar();
        for(int i=0;i<n;i++)
        {
            scanf("%s",&ch[i]);
            for(int j=0;j<m;j++)
            {
                if(ch[i][j]==‘*‘&&ch[i][j+1]==‘*‘&&ch[i][j+2]==‘*‘)
                {
                    s++;
                    break;
                }
            }
        }
        //cout<<s<<endl;
        if(s>2)
            printf("Case %d: Eight\n",l);
        else
            printf("Case %d: Zero\n",l);
    }
    return 0;
}
时间: 2024-12-21 13:54:49

暑假练习赛 007 C - OCR的相关文章

暑假练习赛 007 E - Pairs

E - Pairs Description standard input/outputStatements In the secret book of ACM, it’s said: “Glory for those who write short ICPC problems. May they live long, and never get Wrong Answers” . Everyone likes problems with short statements. Right? Let’s

暑假练习赛 007 B - Weird Cryptography

Weird Cryptography Description standard input/outputStatements Khaled was sitting in the garden under an apple tree, suddenly! , well... you should guess what happened, an apple fell on his head! , so he came up with a new Cryptography method!! The m

暑假练习赛 003 F Mishka and trip

F - Mishka and trip Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Input Output Sample Input Sample Output Hint Description Peter Parker wants to play a g

暑假练习赛 003 A Spider Man

A - Spider Man Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Input Output Sample Input Sample Output Hint Description Peter Parker wants to play a game w

暑假练习赛 003 B Chris and Road

B - Chris and Road Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice _ uDebug Description Input Output Sample Input Sample Output Hint Description And while Mis

暑假练习赛 004 E Joint Stacks

Joint StacksCrawling in process... Crawling failed Time Limit:4000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 5818 uDebug Description Input Output Sample Input Sample Output Hint Description A stack is a d

暑假练习赛 006 B Bear and Prime 100

Bear and Prime 100Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 680C uDebug Description Input Output Sample Input Sample Output Hint Description

暑假集训练习赛题解

比赛链接:http://acm.nyist.net/JudgeOnline/problemset.php?cid=205 对于第一道题 UFS(Union  Find  Set) ,请参见http://blog.csdn.net/u011632342/article/details/37814289,题目大意一样,解法一样,不过后台测试数据还没整太多,数据比较弱... 对于第二道题STR(STRing),本来是想着给大家"送福利"呢,可能由于我的题目表述能力不太好或者样例数据的特殊性或

车牌OCR识别的流程,手机车牌识别

车牌的OCR识别的流程如下: 手机车牌识别背景 随着人们生活水平的提高,汽车方面的业务量也日益暴涨,加上如今"互联网+"的提出,智能终端(智能手机及平板电脑)及移动通信(4G)发展迅速,人们用手机的频率比用电脑的多,加上手机小巧轻便,成为生活中必要的工作及社交工具,可以预见未来几年60%以上的业务将会逐渐转移到智能终端系统上来.伴随着移动端APP的火爆应用,易泊将原来应用在电脑端的车牌识别技术转移到了移动端,手机车牌识别更加灵活,方便,为人们的应用解决了很多实际困难. 手机车牌识别描述