摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1081这题是经典的dp问题,首先,题目的意思是求出一个矩阵的子矩阵,他满足所有子矩阵当中,所有的元素之和最大,那么,这类的问题,我们可以将矩阵压缩成一维来解决,那么,这个问题就转化为一维的求连续的元素之和最大的问题。那么,这样的问题也就解决了。这题已经AC了,具体请参考下面的代码:#include <stdio.h>#include <string.h>#define MAX 101int a[MAX][MAX];int dp[MAX];int fun(int n){ int max 阅读全文
posted @ 2013-05-30 23:08
Sevenmit
阅读(133)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1559这题是经典的dp问题,因为这个是矩阵,那么,可以将这个问题转化为一维数组的问题,这题已经AC了,下面是具体的代码:#include <stdio.h>#include <string.h>#define MAX 1001int a[MAX][MAX];int dp[MAX];int main(int argc , const char *argv){ int ncase,m,n,x,y; scanf("%d",&ncase); while(ncase- 阅读全文
posted @ 2013-05-30 17:09
Sevenmit
阅读(163)
评论(0)
推荐(0)
浙公网安备 33010602011771号