POJ 2948 Martian Mining
| Time Limit: 5000MS | Memory Limit: 65536K | |
| Total Submissions: 2251 | Accepted: 1367 | 
Description
The Mars Odyssey orbiter identified a rectangular area on the surface of Mars that is rich in minerals. The area is divided into cells that form a matrix of n rows and m columns, where the rows go from east to west and the columns go from north to south. The orbiter determined the amount of yeyenum and bloggium in each cell. The astronauts will build a yeyenum refinement factory west of the rectangular area and a bloggium factory to the north. Your task is to design the conveyor belt system that will allow them to mine the largest amount of minerals.
There are two types of conveyor belts: the first moves minerals from east to west, the second moves minerals from south to north. In each cell you can build either type of conveyor belt, but you cannot build both of them in the same cell. If two conveyor belts of the same type are next to each other, then they can be connected. For example, the bloggium mined at a cell can be transported to the bloggium refinement factory via a series of south-north conveyor belts.
The minerals are very unstable, thus they have to be brought to the factories on a straight path without any turns. This means that if there is a south-north conveyor belt in a cell, but the cell north of it contains an east-west conveyor belt, then any mineral transported on the south-north conveyor beltwill be lost. The minerals mined in a particular cell have to be put on a conveyor belt immediately, in the same cell (thus they cannot start the transportation in an adjacent cell). Furthermore, any bloggium transported to the yeyenum refinement factory will be lost, and vice versa. 
 
Your program has to design a conveyor belt system that maximizes the total amount of minerals mined,i.e., the sum of the amount of yeyenum transported to the yeyenum refinery and the amount of bloggium transported to the bloggium refinery.
Input
The input is terminated by a block with n = m = 0.
Output
Sample Input
4 4
0 0 10 9
1 3 10 0
4 2 1 3 
1 1 20 0
10 0 0 0
1 1 1 30
0 0 5 5
5 10 10 10
0 0
Sample Output
98
Hint
Source
| 
 #include <iostream> 
#include <cstdio> #include <cstring> using namespace std; int yeye[555][555],blog[555][555],R,C,dp[555][555]; int getblog(int x,int y) int getyeye(int x,int y) int main()  | 
* This source code was highlighted by YcdoiT. ( style: Codeblocks )
POJ 2948 Martian Mining的更多相关文章
- (中等) POJ 2948 Martian Mining,DP。
		
Description The NASA Space Center, Houston, is less than 200 miles from San Antonio, Texas (the site ...
 - POJ 2948 Martian Mining(DP)这是POJ第200道,居然没发现
		
题目链接 两种矿石,Y和B,Y只能从从右到左,B是从下到上,每个空格只能是上下或者左右,具体看图.求左端+上端最大值. 很容易发现如果想最优,分界线一定是不下降的,分界线上面全是往上,分界线下面都是往 ...
 - POJ 2948 Martian Mining(DP)
		
题目链接 题意 : n×m的矩阵,每个格子中有两种矿石,第一种矿石的的收集站在最北,第二种矿石的收集站在最西,需要在格子上安装南向北的或东向西的传送带,但是每个格子中只能装一种传送带,求最多能采多少矿 ...
 - poj 2948 Martian Mining (dp)
		
题目链接 完全自己想的,做了3个小时,刚开始一点思路没有,硬想了这么长时间,想了一个思路, 又修改了一下,提交本来没抱多大希望 居然1A了,感觉好激动..很高兴dp又有所长进. 题意: 一个row*c ...
 - POJ 2498 Martian Mining
		
Martian Mining Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2194 Accepted: 1326 De ...
 - UVA 1366	 九 Martian Mining
		
Martian Mining Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Sta ...
 - 递推DP UVA 1366 Martian Mining
		
题目传送门 /* 题意:抽象一点就是给两个矩阵,重叠的(就是两者选择其一),两种铺路:从右到左和从下到上,中途不能转弯, 到达边界后把沿途路上的权值相加求和使最大 DP:这是道递推题,首先我题目看了老 ...
 - UVa 1366 - Martian Mining (dp)
		
本文出自 http://blog.csdn.net/shuangde800 题目链接: 点击打开链接 题目大意 给出n*m网格中每个格子的A矿和B矿数量,A矿必须由右向左运输,B矿必须由下向上运输 ...
 - POJ 2948 DP
		
一个row*col的矩阵,每一个格子内有两种矿yeyenum和bloggium,而且知道它们在每一个格子内的数量是多少.最北边有bloggium的收集站,最西边有 yeyenum 的收集站.如今要在这 ...
 
随机推荐
- [IOS NSUserDefaults]的使用:登陆后不再显示登录界面。
			
之前搜了好多地方都没找到实现“登陆后不再显示登录界面,而默认自动登录”的方法. 待我发现有种存储方式叫NSUserDefaults的时候,立马又感觉新技能get了. 简介: NSUserDefault ...
 - RabbitMQ配置文件
			
配置文件Config 在Web的可视化管理界面中可以看到一些文件的路径 比如 Config文件的地址 数据库存放的文件夹 log文件的地址 进入到这个文件夹会发现有这些文件,其中example是con ...
 - Scala高阶函数示例
			
object Closure { def function1(n: Int): Int = { val multiplier = (i: Int, m: Int) => i * m multip ...
 - Chrome控制台 JS调试的一些小技巧
			
$ $_命令返回最近一次表达式执行的结果,功能跟按向上的方向键再回车是一样的,但它可以做为一个变量使用在你接下来的表达式中. $0~$4则代表了最近5个你选择过的DOM节点.在页面右击选择审查元素,然 ...
 - JZOJ 1312:关灯问题
			
传送门 少见的DP再DP题目.题面不短,但是可以看出来这是一道DP题.而且正解的算法复杂度应该是$O(N^3)$.而且给了部分$O(N^4)$的算法的分.可以看出来要AC是要在DP上加上优化的. 设$ ...
 - 关于Linux的内存(free -m)
			
查看Linux服务器下的内存使用情况,可以使用命令free -m.注意此命令只在Linux下有效,在FreeBSD中没有此命令.命令如下所示: used:已经使用的内存数 free:空闲的内存数 sh ...
 - Linux服务器间文件传输
			
利用scp传输文件 1.从服务器下载文件 scp username@servername:/path/filename /tmp/local_destination 例如scp codinglog@1 ...
 - e_msg_c_as_register_req-注册存储过程
			
TOP:BEGIN #Routine body goes here... IF EXISTS ( SELECT * FROM `global_account` WHERE `plantform_id` ...
 - 第六章 jQuery和ajax应用
			
ajax是异步JavaScript和xml的简称. 一. ajax补白 优势 不足(不一定是不足) 不需要任何插件(但需要浏览器支持js) XMLHttpRequest对象在不同浏览器下有差异 优秀的 ...
 - hdu 5878 I Count Two Three (2016 ACM/ICPC Asia Regional Qingdao Online 1001)
			
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5878 题目大意: 给出一个数n ,求一个数X, X>=n. X 满足一个条件 X= 2^a*3^ ...