POJ 2948 Martian Mining】的更多相关文章

Martian Mining Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2251 Accepted: 1367 Description The NASA Space Center, Houston, is less than 200 miles from San Antonio, Texas (the site of the ACM Finals this year). This is the place where t…
Description The NASA Space Center, Houston, is less than 200 miles from San Antonio, Texas (the site of the ACM Finals this year). This is the place where the astronauts are trained for Mission Seven Dwarfs, the next giant leap in space exploration.…
题目链接 两种矿石,Y和B,Y只能从从右到左,B是从下到上,每个空格只能是上下或者左右,具体看图.求左端+上端最大值. 很容易发现如果想最优,分界线一定是不下降的,分界线上面全是往上,分界线下面都是往左,然后就发现每一行,只和上一行有关系,DP可搞. 应该可以单调队列优化,我直接暴力水过了.. #include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include…
题目链接 题意 : n×m的矩阵,每个格子中有两种矿石,第一种矿石的的收集站在最北,第二种矿石的收集站在最西,需要在格子上安装南向北的或东向西的传送带,但是每个格子中只能装一种传送带,求最多能采多少矿. 思路 :记忆化搜索.也可以用递推. #include <stdio.h> #include <string.h> #include <iostream> using namespace std ; ][] ,blog[][] ; ][] ; int DP(int row…
题目链接 完全自己想的,做了3个小时,刚开始一点思路没有,硬想了这么长时间,想了一个思路, 又修改了一下,提交本来没抱多大希望 居然1A了,感觉好激动..很高兴dp又有所长进. 题意: 一个row*col的矩阵,每个格子内有两种矿yeyenum和bloggium,并且知道它们在每个 格子内的数量是多少.最北边有bloggium的收集站,最西边有 yeyenum 的收集站. 现在要在这些格子上面安装向北或者向西的传送带(每个格子自能装一种).问最多能采到多少矿. 传送带只能直着走,不可弯曲,不能交…
Martian Mining Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 2194   Accepted: 1326 Description The NASA Space Center, Houston, is less than 200 miles from San Antonio, Texas (the site of the ACM Finals this year). This is the place whe…
Martian Mining Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVA 1366 #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; ][][]; int main() { int n,m; ][],s…
题目传送门 /* 题意:抽象一点就是给两个矩阵,重叠的(就是两者选择其一),两种铺路:从右到左和从下到上,中途不能转弯, 到达边界后把沿途路上的权值相加求和使最大 DP:这是道递推题,首先我题目看了老半天,看懂后写出前缀和又不知道该如何定义状态好,写不出状态转移方程,太弱了. dp[i][j]表示以(i, j)为右下角时求得的最大值,状态转移方程:dp[i][j] = max (dp[i-1][j] + sum1[i][j], dp[i][j-1] + sum2[i][j]); sum1表示列的…
本文出自   http://blog.csdn.net/shuangde800 题目链接: 点击打开链接 题目大意 给出n*m网格中每个格子的A矿和B矿数量,A矿必须由右向左运输,B矿必须由下向上运输,管子不能拐弯或者间断.要求收集到的A,B矿总量尽量大. 思路 由题意可知,如果格子(i,j)上选择运输A矿的话,那么i行的1~j就要全部选择A矿. 同理,如果选择B矿,那么第j列上的1-i行要全部选择B矿 所以推出下面的状态转移方程式: f[i][j][0]表示第i行第j列为右下角顶点的矩形区域内…
一个row*col的矩阵,每一个格子内有两种矿yeyenum和bloggium,而且知道它们在每一个格子内的数量是多少.最北边有bloggium的收集站,最西边有 yeyenum 的收集站.如今要在这些格子上面安装向北或者向西的传送带(每一个格子自能装一种).问最多能採到多少矿. DP,状态转移方程为 dp[i][j]=Max(dp[i][j-1]+suma[i][j],dp[i-1][j]+sumb[i][j]); 当中sumb[i][j]是第i行1到j列的须要到西边的矿石的价值,suma[i…
dp 可以发现,对于(i,j),要么把它运上去,那么把它运到左边,枚举一下即可 #include<cstdio> #include<cstdlib> #include<algorithm> #include<cstring> #define MAXN 505 using namespace std; int f[MAXN][MAXN]; int a[MAXN][MAXN],b[MAXN][MAXN]; int s[MAXN][MAXN],t[MAXN][MA…
描述 The NASA Space Center, Houston, is less than 200 miles from San Antonio, Texas (the site of the ACM Finals this year). This is the place where the astronauts are trained for Mission Seven Dwarfs, the next giant leap in space exploration. The Mars…
分析: 对于网格grid[i][j]如果放向上的管道,那么grid[i][k], k>j 就只能放向上的管道了. 那么定义dp[i][j]表示第i行,最后一个放向左的管道是j的最大总矿量. j = 0表示全放向上,j = m表示全放向左. 如果grid[i][j]要往放向上的管道的话,前提是grid[i-1][j]也要是向上的管道. 因此转移为dp[i][j] = max(dp[i-1][k]+sumA(1,j)+sumB(j+1,n) ), k >= j 对于N= 500这样的规模,转移有点…
题意:给定一个n*m的网格,每个格子里有A矿和B矿数量,A必须由右向左运,B只能从下向上运,中间不能间断,问最大总数量. 析:一个简单DP,dp[i][j] 表示 从 (0, 0) 到 (i, j) 最大人运输量.要么向左运输,要么向上运输,取最大值. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include…
网上的题解几乎都是一样的: d(i, j, 0)表示前i行前j列,第(i, j)个格子向左运输能得到的最大值. d(i, j, 1)是第(i, j)个格子向上运输能得到的最大值. 但是有一个很关键的问题没有解释: 某个格子中的A矿或者B矿一定有其中一种能够运出来吗?有没有可能这个格子没有修建管道,仅仅是为了给其他管道让路,使得总体取得最大值呢? 从题解的状态转移方程上来看,不会的. 自己YY了好久,也没有想到一个能严格证明的方法.. #include <iostream> #include &…
OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递推. 构造法.(POJ 3295) 模拟法.(POJ 1068,POJ 2632,POJ 1573,POJ 2993,POJ 2996) 二…
著名题单,最初来源不详.直接来源:http://blog.csdn.net/a1dark/article/details/11714009 OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递…
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDIATE DECODABILITY…
本文出自   http://blog.csdn.net/shuangde800 刘汝佳<算法竞赛入门经典-训练指南>的动态规划部分的习题Beginner  打开 这个专题一共有25题,刷完后对dp的感觉提升了不少. 现把解题报告整理了一下,希望对大家能有帮助. 入门习题 (Exercises: Beginner) UVa11584 Partitioning by Palindromes 入门题目 LA4256 Salesman 入门题目 UVa10534 Wavio Sequence 可以转化…
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093. 1094.1095.1096.1097.1098.1106.1108.1157.116…
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  1024   Calendar Game       简单题  1027   Human Gene Functions   简单题  1037   Gridland            简单题  1052   Algernon s Noxious Emissions 简单题  1409   Commun…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
题目连接 http://poj.org/problem?id=2367 Genealogical tree Description The system of Martians' blood relations is confusing enough. Actually, Martians bud when they want and where they want. They gather together in different groups, so that a Martian can…
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并查集======================================[HDU]1213   How Many Tables   基础并查集★1272   小希的迷宫   基础并查集★1325&&poj1308  Is It A Tree?   基础并查集★1856   More i…
Genealogical tree Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2920 Accepted: 1962 Special Judge Description The system of Martians' blood relations is confusing enough. Actually, Martians bud when they want and where they want. They ga…
Instantaneous Transference Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 6204   Accepted: 1389 Description It was long ago when we played the game Red Alert. There is a magic function for the game objects which is called instantaneous…
在进行文本挖掘时,TSQL中的通配符(Wildchar)显得功能不足,这时,使用“CLR+正则表达式”是非常不错的选择,正则表达式看似非常复杂,但,万变不离其宗,熟练掌握正则表达式的元数据,就能熟练和灵活使用正则表达式完成复杂的Text Mining工作. 一,正则表达式的特殊字符 1,常用元字符 用以匹配特定的字符(字母,数字,符号),注意字母是区分大小写的: . :匹配除换行符以外的任意字符 \w :匹配字母或数字或下划线或汉字 \s :匹配任意的空白符 \d :匹配数字 \b :匹配单词的…
Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798   Special Judge Description Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…