当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3675:Flight Control

题目描述
You're the key programmer employed by a flight control center, and you've just been assigned a task which is to monitor the activity of aircrafts in a particular area.

Since some of the aircrafts in that area are so far away from the control that the sensors can't get a lock on them, it is impossible to determine the actual number of aircrafts in that area; however, the scanning of the flight control's sensor arrays has shown the amount of energy sensed in each grid of that area, and by analyzing that data, you will be able to get a general view of that area.

You have decided to first in order to write a program to simplify the calculation of the minimum number of aircrafts. you need to follow the following rules:

1. A grid from which the sensor arrays get no reading indicates a grid without any aircraft;
2. A grid with a positive value indicates a trace of an aircraft, and in that grid, a) An aircraft may be present, or b) It is the trace of exactly one aircraft traveling either horizontal or vertical (notice the aircraft can't change the flying direction halfway);
3. If a series of adjacent grids on a row or a column are the trace of one aircraft, then the amount of energy in them (from top to bottom or from left to right) must be either strictly increasing or strictly decreasing.
输入解释
There are multiple test cases in the input file. Each test case starts with two integers, N and M (1<=N<=50, 1<=M<=9) , the length and width of the area that the you're monitoring. Each of the following N lines consists of M integers, the j -th integer on the i -th line representing the amount of heat sensed by the flight control's sensor array. It is guaranteed that every integer in the input will fit into a 32-bit signed integer.

There is a blank line after each test case. A single line with N = 0 and M = 0 indicates the end of input file.
输出解释
For each test case, print one integer on a separate line, the minimum possible number of aircrafts, in the format as indicated in the sample output.
输入样例
3 3 
1 2 3
4 5 6
7 8 9

0 0
输出样例
Case 1: 3
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3675

最后修改于 2020-10-25T23:05:51+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 32768/32768K(Java/Others)