10168_HomeontheRange

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

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

Pro.ID

10168

Title

Home on the Range

Title链接

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

AC

13

Submit

17

Ratio

76.47%

时间&空间限制

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

    Farmer John grazes his cows on a large, square field N (2 ≤ N ≤ 250) miles on a side (because, for some reason, his cows will only graze on precisely square land segments). Regrettably, the cows have ravaged some of the land (always in 1 mile square increments). FJ needs to map the remaining squares (at least 2×2 on a side) on which his cows can graze (in these larger squares, no 1×1 mile segments are ravaged).

    Your task is to count up all the various square grazing areas within the supplied dataset and report the number of square grazing areas (of sizes ≥ 2×2) remaining. Of course, grazing areas may overlap for purposes of this report.

    输入

    Multiple test cases. For each case:

    Line 1:     N, the number of miles on each side of the field.

    Line 2..N+1:    N characters with no spaces. 0 represents "ravaged for that block"; 1 represents "ready to eat".

    输出

    Description

    Farmer John grazes his cows on a large, square field N (2 ≤ N ≤ 250) miles on a side (because, for some reason, his cows will only graze on precisely square land segments). Regrettably, the cows have ravaged some of the land (always in 1 mile square increments). FJ needs to map the remaining squares (at least 2×2 on a side) on which his cows can graze (in these larger squares, no 1×1 mile segments are ravaged).

    Your task is to count up all the various square grazing areas within the supplied dataset and report the number of square grazing areas (of sizes ≥ 2×2) remaining. Of course, grazing areas may overlap for purposes of this report.

    Input

    Multiple test cases. For each case:

    Line 1:     N, the number of miles on each side of the field.

    Line 2..N+1:    N characters with no spaces. 0 represents "ravaged for that block"; 1 represents "ready to eat".

    Output

    For each case, output potentially several lines with the size of the square and the number of such squares that exist. Order them in ascending order from smallest to largest size.

    Sample Input

    6
    101111
    001111
    111111
    001111
    101101
    111001

    Sample Output

    2 10
    3 4
    4 1

    Source

    样例输入

    6
    101111
    001111
    111111
    001111
    101101
    111001

    样例输出

    2 10
    3 4
    4 1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部