Character Recognition? Time Limit: 1 sec memory limit: 128 MB
Submit: 156 solved: 98
[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
The key to this question is to find the difference between the fourth line ......
The AC code is as follows:
#include<iostream>#include<cstring>using namespace std;int main(){ int n; int i,j; char a[5][100]; cin>>n; for(i=0;i<5;i++) cin>>a[i]; int l=strlen(a[0]); int bj=0; for(i=0;i<l;i++) { bj++; if(bj==1&&a[3][i]=='*') cout<<"2"; if(bj==2&&a[3][i]=='*') cout<<"1"; if(bj==3&&a[3][i]=='*') cout<<"3"; if(bj==4) bj=0; } cout<<endl; return 0;}