acm_dp
wdcxccsdn
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdoj1208_Pascal's Travels(dp)
思路:记忆dp,注意数据类型#include<iostream> #include<string.h>using namespace std;int input[50][50]; long long table[50][50];long long dp(int x, int y, int n) { int rx = x - 9 > 0 ? x - 9 : 0; int ry = y原创 2015-06-18 00:07:35 · 473 阅读 · 0 评论 -
hdoj1158_Employment Planning
思路:记忆dp,用前一个月的所有可取状态更新后一个月的所有可取状态,结果是最后一个月的所有可取状态的最小值(可取状态即雇佣worker数>=所需worker数)#include<iostream> #include<vector> #include<algorithm> #include<utility> using namespace std;vector<int> wn; //worke原创 2015-06-14 14:17:59 · 587 阅读 · 0 评论 -
hdoj1331_Function Run Fun(dp)
思路:记忆dp#include<iostream> #include<string.h>using namespace std;int w[100][100][100];int solve(int a, int b, int c) { if (a <= 0 || b <= 0 || c <= 0) return 1; if (a > 20 || b > 20 || c原创 2015-06-13 13:57:28 · 530 阅读 · 0 评论 -
hdoj1074_Doing Homework(dp)
思路:状态压缩dp#include<iostream> #include<vector> #include<algorithm> #include<string> using namespace std;//状态结构体 struct state{ int prestate,precourse, minreduce, usedtime; };//课程结构体 struct course{原创 2015-06-12 10:38:28 · 505 阅读 · 0 评论 -
hdoj1069_Monkey and Banana(dp)
思路:每一种方块可以多次利用,不过最终只可以利用6种姿势,全部输入排序,然后从大到小dp#include<iostream> #include<vector> #include<algorithm> #include<string.h> using namespace std;struct rec{ int l, w,h; };bool cmp(rec r1, rec r2) { i原创 2015-06-09 18:42:34 · 417 阅读 · 0 评论 -
hdoj1058_Humble Numbers(dp)
思路:4个游标打表#include<iostream> #include<string.h> #include<vector> #include<algorithm> using namespace std;unsigned long long table[5843];void gettable() { int a = 1, b = 1, c = 1, d = 1; table[1]原创 2015-06-09 17:55:29 · 582 阅读 · 0 评论 -
hdoj1244_Max Sum Plus Plus Plus(dp)
题目中先后的意思是顺序前后的意思#include<iostream> #include<string.h> #include<algorithm>using namespace std;long long num[10100], len[100], table[10100][100], sum[10100];long long dp(int n,int m) { memset(table,原创 2015-06-28 17:06:33 · 541 阅读 · 0 评论 -
hdoj1421_搬寝室(dp)
注意table初始化的值,尽量大,不过不能用INT_MAX,会溢出;不能用系统自带pow,会TLE#include<iostream> #include<climits> #include<cmath> #include<algorithm> #include<cstdio>using namespace std;int input[2001], table[2001][1001];void dp(原创 2015-06-28 09:56:56 · 463 阅读 · 0 评论 -
hdoj1422_重温世界杯(dp)
#include<iostream> #include<cstdio> #include<algorithm> using namespace std;int input[1000000];int main() { int n; while (scanf("%d",&n)!=-1) { for (int i = 0; i < n; i++) {原创 2015-06-28 00:08:39 · 487 阅读 · 0 评论 -
hdoj1059_Dividing
思路:多重背包#include<iostream> #include<cstdio> #include<algorithm> #include<string.h> #include<vector>using namespace std;int input[7]; vector<int> v; int table[60010];bool dp(int sum) { v.clear();原创 2015-06-24 18:29:50 · 457 阅读 · 0 评论 -
hdoj1428_漫步校园(dp)
思路:bfs从后往前求路径长度,dfs从前往后求路径数,记忆dp#include<iostream> #include<vector> #include<string.h> #include<queue> #include<utility> using namespace std;int map[60][60]; int dir[4][2] = { { -1, 0 }, { 0, 1 }, { 1,原创 2015-06-05 13:37:26 · 415 阅读 · 0 评论 -
hdoj1159_Common Subsequence(dp)
#include<iostream> #include<string.h> #include<cstring> #include<string> #include<algorithm>using namespace std;int table[1000][1000]; string s1, s2;int dp() { memset(table, 0, sizeof(table));原创 2015-06-25 11:46:03 · 480 阅读 · 0 评论 -
hdoj2602_Bone Collector(dp)
思路:01背包#include<iostream> #include<string.h> #include<algorithm>using namespace std;int val[1001], wei[1001], table[1001];int dp(int n,int w) { memset(table, 0, sizeof(table)); for (int i = 0;原创 2015-06-23 17:50:38 · 549 阅读 · 0 评论 -
hdoj1176_免费馅饼(dp)
思路:从后向前更新 #include #include #include #include #include using namespace std; int map[100010][11]; int solve(int maxtime) { int res[11], tres[11]; memset(tres, 0, sizeof(tres)); for (int i原创 2015-06-03 18:06:11 · 415 阅读 · 0 评论 -
hdoj1257_最少拦截系统(dp)
#include<iostream> #include<vector>using namespace std;int input[30001]; vector<int> no;int solve(int n) { no.clear(); for (int i = 0; i < n; i++) { int j = 0; for (; j < no原创 2015-06-22 13:51:11 · 425 阅读 · 0 评论 -
hdoj1078_FatMouse and Cheese(dp)
思路:记忆dp#include<iostream> #include<string.h> #include<algorithm>using namespace std;bool used[500][500]; int chess[500][500]; long long table[500][500];long long dp(int x, int y, int n, int k) { us原创 2015-06-22 09:44:46 · 412 阅读 · 0 评论 -
hdoj1723_Distribute Message(dp)
#include<iostream> #include<string.h> using namespace std;int table[80];void dp(int n,int m) { memset(table, 0, sizeof(table)); table[0] = 1; for (int i = 0; i < n; i++) { for (原创 2015-06-20 23:59:58 · 415 阅读 · 0 评论 -
hdoj1160_FatMouse's Speed(dp)
思路:记忆dp,先排序#include<iostream> #include<vector> #include<algorithm> #include<utility>using namespace std;struct node{ int w, s, sum, pre, ini_no; };bool cmp(node n1, node n2) { if (n1.w != n2.w)原创 2015-06-18 16:25:22 · 421 阅读 · 0 评论 -
hdoj1114_Piggy-Bank(dp)
#include<cstdio> #include<iostream> #include<algorithm> #include<string.h> #include<utility> #include<vector> using namespace std;int dp[10010], coinw[10010], coinp[10010];void solve(int w, int n) {原创 2015-06-16 00:17:10 · 488 阅读 · 0 评论
分享