zoukankan      html  css  js  c++  java
  • 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代码:

     1 #include <stdio.h>
     2 #include <algorithm>
     3 #include <iostream>
     4 #include <string.h>
     5 #include <string>
     6 #include <math.h>
     7 #include <stdlib.h>
     8 #include <queue>
     9 #include <stack>
    10 #include <set>
    11 #include <map>
    12 #include <list>
    13 #include <iomanip>
    14 #include <vector>
    15 #pragma comment(linker, "/STACK:1024000000,1024000000")
    16 #pragma warning(disable:4786)
    17 
    18 using namespace std;
    19 
    20 const int INF = 0x3f3f3f3f;
    21 const int MAX = 1000 + 10;
    22 const double eps = 1e-8;
    23 const double PI = acos(-1.0);
    24 
    25 int main()
    26 {
    27     int n , i;
    28     char str[7][57];
    29     scanf("%d",&n);
    30     for(i = 1;i <= 5;i ++)
    31         cin >> str[i] + 1;
    32     n *= 4;
    33     for(i = 1;i <= n;i += 4)
    34     {
    35         if(str[4][i] == '*')
    36             cout << "2";
    37         else if(str[4][i + 1] == '*')
    38             cout << "1";
    39         else
    40             cout << "3";
    41     }
    42     puts("");
    43     return 0;
    44 }
    View Code
  • 相关阅读:
    从实战角度超级详解中大型企业微服务化的六大核心关键技术
    Web API 入门的相关文章
    发布asp.net core3.1 web api to IIS
    web api 起步之一
    工作中常见的一些英语
    SSIS--Excel Demo
    SSIS中常用的一些Task组件
    企业系统上Azure的建议与注意事项
    POST提交时防止密码泄漏
    转 Netbackup用于技术支持的问题报告(报障模版)
  • 原文地址:https://www.cnblogs.com/jeff-wgc/p/4456439.html
Copyright © 2011-2022 走看看