Central South University OJ 1330 Character Recognition

Source: Internet
Author: User
1330: Character Recognition? Time Limit: 1 sec memory limit: 128 MB
Submit: 158 solved: 100
[Submit] [Status] [web board] Description

Your task is to write a program for character recognition. Don't worry, you only need to identify 1, 2, 3, as follows:

 

.*.******

.*...*..*

.*.******

.*.*....*

.*.******

Input

The input contains only one group of data, which consists of six rows. The first row contains N (1 <=n <= 10) characters ). Each row of the following five rows contains 4 n characters. Each character exactly occupies five rows and three columns, followed by an empty column (filled ).

Output

The output should contain one line, that is, each character recognized.

Sample Input
3.*..***.***..*....*...*..*..***.***..*..*.....*..*..***.***.
Sample output
123
Hintsource

Hunan ninth College Computer Program Design Competition

To determine the number of characters, you only need to check the position of * in each of the four characters in the fourth row of the array.

#include<iostream>#include<cstring>using namespace std;int main(){    int n,k,i,j;    char a[5][45],b[5];    memset(a,0,sizeof(a));    cin>>n;    for(i=0;i<5;i++)        for(j=0;j<4*n;j++)        cin>>a[i][j];    /*for(j=0;j<4*n;j++)        cout<<a[3][j]<<" ";        cout<<endl;        */    for(j=1;j<=n;j++)       {           int l=1;           for(i=4*(j-1);i<4*j;i++)            {                b[l]=a[3][i];                if(b[l]=='*')                   {                       k=l;                    //cout<<k<<endl;                    if(k==2)                        cout<<'1';                    else if(k==1)                        cout<<'2';                    else                        cout<<'3';                   }                 l++;            }       }    cout<<endl;} 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.