您的位置:首页 > 其它

CDZSC_2016寒假个人赛(2)-C

2016-02-19 18:08 204 查看
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 1000100
typedef long long ll;

int main()
{
#ifdef zsc
freopen("input.txt","r",stdin);
#endif

int 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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  模拟