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

建议使用的浏览器:

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

2858:Oil on the Mars

题目描述
According to top-secret mars sensor transition, a big oil field was founded on the Mars. The field is divided into N*M equal square, and each square contains some oil resources. Our army want to occupy all the territory of the field, but the UN (United Nations) will allow us to occupy only K squares. Of course, we want to get control over as many oil as possible, but, we will have to guard all our territory. So, they need our territory to be easy-controlled, i.e. from any square to any it must be possible to get moving only along two directions (selected from the next list: left, right, up, down; for different squares pairs of directions may differ).
You are to write a program, which determines, how many oil will be occupied by us.
输入解释
There are several test cases. On the first line of input there are 3 integer numbers N,M,K (1<=N,M<=15, 0<=K<=N*M). The next N lines contain M integers each, which are the number of oil resource on that square. Each of this numbers lies in range of 0 to 1000.
输出解释
One line for a case, write string "Oil : X", where integer number X --- the maximal number of oil which can be controlled.
输入样例
2 3 4 
10 20 30 
40 2 3
输出样例
Oil : 100 
来自杭电HDUOJ的附加信息
Recommend gaojie

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

源链接: HDU-2858

最后修改于 2020-10-25T22:57:33+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
15000/6000MS(Java/Others) 65536/65536K(Java/Others)