CDZSC_2016寒假个人赛(2)-C

来源:互联网 发布:maxwell软件价格 编辑:程序博客网 时间:2024/05/21 09:22
Write a program that recognizes characters. Don’t worry, because you only need to recognize three digits: 1, 2 and 3. Here they are:

.*. *** ***

 .*. ..* ..* 

.*. *** *** 

.*. *.. ..* .*.

 *** ***

Input
The input contains only one test case, consisting of 6 lines. The first line contains n, the number of characters to recognize (1 ≤ n ≤ 10). Each of the next 5 lines contains 4n characters. Each character contains exactly 5 rows and 3 columns of characters followed by an empty column (filled with ‘.’).
Output
The output should contain exactly one line, the recognized digits in one line.
Sample Input

.*..***.***.

.*....*...*. 

.*..***.***. 

.*..*.....*. 

.*..***.***.

Sample Output

123


思路:


 这题只有三个数字,1,2,3.所以只要判断5*n的二维字母表就可以了。



#include<iostream>#include<algorithm>#include<cstring>#include<string>#include<cmath>#include<cstdio>using namespace std;#define T 1000100typedef long long ll;int main(){#ifdef zscfreopen("input.txt","r",stdin);#endifint n,i,j,k;ll m;char s[50][500];while(~scanf("%d",&n)){m = 0;for(i=0;i<5;++i){scanf("\n%s",&s[i]);}for(i=1;s[0][i];++i){if(s[0][i-1]=='.'&&s[0][i]=='*'){if(s[0][i]=='*'&&s[1][i]=='*'&&s[2][i]=='*'&&s[3][i]=='*'&&s[4][i]=='*'){m = m*10 + 1;}else if(s[0][i]=='*'&&s[1][i]=='.'&&s[2][i]=='*'    &&s[3][i]=='*'&&s[4][i]=='*'){m = m*10 + 2;}else if(s[0][i]=='*'&&s[1][i]=='.'&&s[2][i]=='*'    &&s[3][i]=='.'&&s[4][i]=='*'){m = m*10 + 3;}}}printf("%lld\n",m);}return 0;}


0 0
原创粉丝点击