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:
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
.*. *** ***
.*. ..* ..*
.*. *** ***
.*. *.. ..* .*.
*** ***
InputThe 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
3
.*..***.***.
.*....*...*.
.*..***.***.
.*..*.....*.
.*..***.***.
Sample Output123
思路:
这题只有三个数字,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
- CDZSC_2016寒假个人赛(2)-C
- CDZSC_2016寒假个人赛(2)-G(模拟)
- CDZSC_2016寒假个人赛(2)-L(模拟)
- 2016寒假个人赛(1)C(背包)
- 寒假个人总结
- 2016寒假个人赛(1)B(数学)
- 2016寒假个人赛(1)A(贪心)
- 2016寒假个人赛(1)J(模拟)
- 20160202寒假训练赛2
- 2015寒假训练赛一 C题(hdacm 4740)
- 寒假集训2 c 时钟问题 hdu 5387
- SDUT - 2017年寒假集训 阶段测试赛3(个人) -- 解题报告
- 寒假训练---训练赛2--Fighting
- 寒假训练--训练赛2--Good Luck!
- 寒假训练--训练赛2--加密术
- 大一寒假c语言笔记
- 寒假C语言学习安排
- 寒假的c语言进阶
- 关于使用 QEMU 对系统进行 profile
- simditor 图片上传成功后修改图片地址
- 制作framework库文件的详细步骤---iOS9,Xcode7.2
- css中长度尺寸的一些总结
- 基于zhphpWeixinApi.class.php开发微信+ 百度API翻译案例
- CDZSC_2016寒假个人赛(2)-C
- 【理解】线段树中树链存储方式
- ZOJ1027
- redis 安装及配置 mongo
- Objective C类方法load和initialize的区别
- 个人算法练习库-go语言版
- 线程池
- 操作csv文件
- center与centering之间的区别