csu oj 1330 字符识别?

http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1330

1330: 字符识别?

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 419  Solved: 296
[Submit][Status][Web Board]

Description

你的任务是写一个程序进行字符识别。别担心,你只需要识别1, 2, 3,如下:

.*.  ***  ***

.*.  ..*  ..*

.*.  ***  ***

.*.  *..  ..*

.*.  ***  ***

Input

输入仅包含一组数据,由6行组成。第一行为字符的个数n(1<=n<=10)。以下5行每行包含4n个字符。每个字符恰好占5行3列,然后是一个空列(用"."填充)。

Output

输出应包含一行,即识别出的各个字符。

Sample Input

3
.*..***.***.
.*....*...*.
.*..***.***.
.*..*.....*.
.*..***.***.

Sample Output

123

分析:

直接判断a[4][1] a[4][3] a[4][3]是否等于“*” 即可。

AC代码:
 #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <vector>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma warning(disable:4786) using namespace std; const int INF = 0x3f3f3f3f;
const int MAX = + ;
const double eps = 1e-;
const double PI = acos(-1.0); int main()
{
int n , i;
char str[][];
scanf("%d",&n);
for(i = ;i <= ;i ++)
cin >> str[i] + ;
n *= ;
for(i = ;i <= n;i += )
{
if(str[][i] == '*')
cout << "";
else if(str[][i + ] == '*')
cout << "";
else
cout << "";
}
puts("");
return ;
}
上一篇:csu oj 1339: 最后一滴血


下一篇:csu oj 1341 string and arrays