22168_DigitsRecognizeSyste

2022-5-16 18:21| 发布者: Hocassian| 查看: 32| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506169023100-Problem List-采集的数据-后羿采集器.html

Pro.ID

22168

Title

Digits Recognize System

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22168

AC

4

Submit

10

Ratio

40.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Given a n*m 01 array, consists by "0" and "1", which respect a picture, 0 for blank and 1 for colored. Please find out the digits (0-9) in the picture. Note: there may be many digits in one picture, please output the digits from left to right, and top to bottom (according to its left-up most point). You can find it in the Sample.

    All the digits appear in the picture are legality. Digits are represented in the form listed in Table 1.

    Table 1    Digit representation of 0-9

    0    1    2    3    4    5    6    7    8    9
    111  001  111  111  101  111  111  111  111  111
    101  001  001  001  101  100  100  001  101  101
    101  001  111  111  111  111  111  001  111  111
    101  001  100  001  001  001  101  001  101  001
    111  001  111  111  001  111  111  001  111  111

    Digits will be appearing just like showing above, and they may be zoom in or zoom out. The nonstandard situation will not happen in the picture.

    The effect of "zoom in & zoom out" can make the lines of digits become longer synchronal, but not become shorter or wider. For example, the digit "4" can transform to:

    1001
    1001
    1111
    0001
    0001
    0001
    0001

    But it can not transform to:

    1101
    1101
    1111
    0001
    0001

    (the line become wider).

    And it can't transform to:

    001
    101
    101
    111
    001
    001

    (the vertical lines of both sides don't be zoom out synchronal).

    The input ensure each two digits to be recognize will be separated by one line or one column "0" at least. The input ensure every digit to be recognize have legal shape, i.e. every "1" in the picture should be one part of the legal recognized digit.

    输入

    There are multiple test cases.

    For each test case, there are two positive integers n and m ( n < 100, m < 100 ). Each of the following n lines contains m characters, this "01" matrix shows the picture to be recognized.

    Input terminated by "0 0".

    Assume every test case contains one digit to be recognized at least.

    输出

    Description

    Given a n*m 01 array, consists by "0" and "1", which respect a picture, 0 for blank and 1 for colored. Please find out the digits (0-9) in the picture. Note: there may be many digits in one picture, please output the digits from left to right, and top to bottom (according to its left-up most point). You can find it in the Sample.

    All the digits appear in the picture are legality. Digits are represented in the form listed in Table 1.

    Table 1    Digit representation of 0-9

    0    1    2    3    4    5    6    7    8    9
    111  001  111  111  101  111  111  111  111  111
    101  001  001  001  101  100  100  001  101  101
    101  001  111  111  111  111  111  001  111  111
    101  001  100  001  001  001  101  001  101  001
    111  001  111  111  001  111  111  001  111  111

    Digits will be appearing just like showing above, and they may be zoom in or zoom out. The nonstandard situation will not happen in the picture.

    The effect of "zoom in & zoom out" can make the lines of digits become longer synchronal, but not become shorter or wider. For example, the digit "4" can transform to:

    1001
    1001
    1111
    0001
    0001
    0001
    0001

    But it can not transform to:

    1101
    1101
    1111
    0001
    0001

    (the line become wider).

    And it can't transform to:

    001
    101
    101
    111
    001
    001

    (the vertical lines of both sides don't be zoom out synchronal).

    The input ensure each two digits to be recognize will be separated by one line or one column "0" at least. The input ensure every digit to be recognize have legal shape, i.e. every "1" in the picture should be one part of the legal recognized digit.

    Input

    There are multiple test cases.

    For each test case, there are two positive integers n and m ( n < 100, m < 100 ). Each of the following n lines contains m characters, this "01" matrix shows the picture to be recognized.

    Input terminated by "0 0".

    Assume every test case contains one digit to be recognized at least.

    Output

    For each test case, output the digits that be recognized successfully on a single line, from left to right, and from top to bottom.

    Sample Input

    5 3
    111
    101
    111
    001
    111
    14 11
    01010011110
    01010010000
    01010010000
    01110011110
    00010000010
    00010000010
    00010000010
    00000011110
    11111000000
    00001000001
    11111000001
    10000000001
    11111000001
    00000000001
    0 0

    Sample Output

    9
    2451

    Source

    样例输入

    5 3
    111
    101
    111
    001
    111
    14 11
    01010011110
    01010010000
    01010010000
    01110011110
    00010000010
    00010000010
    00010000010
    00000011110
    11111000000
    00001000001
    11111000001
    10000000001
    11111000001
    00000000001
    0 0

    样例输出

    9
    2451

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部