上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 22 下一页
摘要: 这题要注意的是 每次出发 起点和终点不同就可以算作不同路径思路: 从第一个起点开始dfs dp[x][y]记录从该点出发到达最后目的地有多少种走法#include#include#include#includeusing namespace std;int mat[200][200];int ... 阅读全文
posted @ 2015-02-01 22:55 sola94 阅读(138) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2571思路: dp[i+1][j]=max(dp[i+1][j],dp[i][j]+mat[i+1][j]); dp[i][j+1]=max(dp[i][j+1],dp[i][j]+m... 阅读全文
posted @ 2015-02-01 16:06 sola94 阅读(132) 评论(0) 推荐(0) 编辑
摘要: http://acm.neu.edu.cn/hustoj/problem.php?cid=1047&pid=4题意:数字1到n 任意排列 求排列成有序序列最少交换次数思路:求最小交换次数有两种 1 交换的两数必须相邻 (poj 2299) 通过归并排序求出其逆序数即为所求值 ... 阅读全文
posted @ 2015-02-01 14:49 sola94 阅读(508) 评论(0) 推荐(0) 编辑
摘要: http://acm.neu.edu.cn/hustoj/problem.php?id=1492题意: 有n个盒子 现在有两种操作: 1 在序号为x的倍数的盒子里放y个球 2 查询序号x到y的盒子里的球的总数思路: 当时以为线段数 而且没... 阅读全文
posted @ 2015-02-01 13:40 sola94 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.neu.edu.cn/hustoj/contest.php?cid=1047题解:http://acm.neu.edu.cn/?p=56实在太水 只水了五道= =A:#include#include#includeusing namespace std;double nu... 阅读全文
posted @ 2015-02-01 11:40 sola94 阅读(167) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1159题意 : 给出两个字符串 求出最长公共子序列思路: if(str1[i]==str2[j]) { dp... 阅读全文
posted @ 2015-01-31 00:04 sola94 阅读(123) 评论(0) 推荐(0) 编辑
摘要: http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=17322裸最大连续子序列 竟然差点拿来当区间dp来做= =#include #include using namespace std; #define INF 100000... 阅读全文
posted @ 2015-01-30 19:12 sola94 阅读(99) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2602题意 : n个骨头 m的容量 给出n个骨头的 value 和 volume 求m能容纳的最大价值思路 : dp[j]=max(dp[j],dp[j-w[i]]+v[i]);#include#i... 阅读全文
posted @ 2015-01-30 16:35 sola94 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 算法入门经典 训练指南 p189#include#include#include#include#includeusing namespace std;struct Item{ int s,b; Item(int s,int b) :s(s),b(b) {} bool operat... 阅读全文
posted @ 2015-01-30 16:04 sola94 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1272这题要求任意两个房间都相通又不能有环即通过并查集求出是否构成最小生成树#include#include#include#includeusing namespace std;#define maxn 1000... 阅读全文
posted @ 2015-01-30 12:32 sola94 阅读(186) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 22 下一页