10298_OilSkimming

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

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

Pro.ID

10298

Title

Oil Skimming

Title链接

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

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

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

    Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped up by enterprising oil barons. One such oil baron has a special plane that can skim the surface of the water collecting oil on the water's surface. However, each scoop covers a 10m by 20m rectangle (going either east/west or north/south). It also requires that the rectangle be completely covered in oil, otherwise the product is contaminated by pure ocean water and thus unprofitable!

    Given a map of an oil slick, the oil baron would like you to compute the maximum number of scoops that may be extracted. The map is an N×N grid where each cell represents a 10m square of water, and each cell is marked as either being covered in oil or pure water.

    输入

    The input starts with an integer T (1 ≤ T ≤ 100) indicating the number of cases.

    Each case starts with an integer N (1 ≤ N ≤ 600) indicating the size of the square grid. Each of the following N lines contains N characters that represent the cells of a row in the grid. A character of '#' represents an oily cell, and a character of '.' represents a pure water cell.

    输出

    Description

    Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped up by enterprising oil barons. One such oil baron has a special plane that can skim the surface of the water collecting oil on the water's surface. However, each scoop covers a 10m by 20m rectangle (going either east/west or north/south). It also requires that the rectangle be completely covered in oil, otherwise the product is contaminated by pure ocean water and thus unprofitable!

    Given a map of an oil slick, the oil baron would like you to compute the maximum number of scoops that may be extracted. The map is an N×N grid where each cell represents a 10m square of water, and each cell is marked as either being covered in oil or pure water.

    Input

    The input starts with an integer T (1 ≤ T ≤ 100) indicating the number of cases.

    Each case starts with an integer N (1 ≤ N ≤ 600) indicating the size of the square grid. Each of the following N lines contains N characters that represent the cells of a row in the grid. A character of '#' represents an oily cell, and a character of '.' represents a pure water cell.

    Output

    For each case, one line should be produced, formatted exactly as follows: "Case X: M" where X is the case number (starting from 1) and M is the maximum number of scoops of oil that may be extracted.

    Sample Input

    1
    16
    ......
    .##...
    .##...
    ....#.
    ....##
    ......

    Sample Output

    Case 1: 3

    Source

    样例输入

    1
    16
    ......
    .##...
    .##...
    ....#.
    ....##
    ......

    样例输出

    Case 1: 3

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部