算法入门第九章
刘汝佳算法入门竞赛经典
小刀刺大熊
这个作者很懒,什么都没留下…
展开
-
例题9-11(uva-1331)
#include <iostream>#include <istream>#include <sstream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>原创 2021-07-10 15:32:46 · 83 阅读 · 0 评论 -
例题9-16(uva-1252)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-20 13:45:29 · 90 阅读 · 0 评论 -
例题9-15(uva-10817)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-16 10:42:22 · 100 阅读 · 0 评论 -
例题9-14(uva-1218)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-19 20:36:42 · 90 阅读 · 0 评论 -
例题9-13(uva-1220)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-14 18:15:24 · 85 阅读 · 0 评论 -
例题9-12(uva-12186)
网站暂时访问不了 未提交#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#inc原创 2020-10-14 10:05:22 · 93 阅读 · 0 评论 -
例题9-10(uva-1626)
const int MAXSIZE = 128;string in;int dp[MAXSIZE][MAXSIZE];bool IsMatch(char a, char b) { return (a == '(' && b == ')') || (a == '[' && b == ']');}void Print(int i, int j) { if (i > j) return; if (i == j) { if (in[i] == '('原创 2020-10-13 13:23:01 · 116 阅读 · 0 评论 -
例题9-9(uva-10003)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-13 11:08:35 · 72 阅读 · 0 评论 -
例题9-8(uva-1625)
#include <iostream>#include <istream>#include <sstream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>原创 2021-07-04 17:57:44 · 64 阅读 · 0 评论 -
01背包学习
for(i=1;i<=n;i++) for(j=cost[i];j<=V;j++){ dp[i][j]=max(dp[i-1][j-cost[i]]+val[i],dp[i-1][j]); //当前物品,放还是不放 }dp[j]表示体积为j的时候的最大价值 for(i=1;i<=n;i++) for(j=V;j>=cost[i];j--) dp[j]=max(dp[j],dp[转载 2021-06-14 16:14:45 · 318 阅读 · 0 评论 -
例题9-7(uva-11584)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-12 21:09:18 · 89 阅读 · 0 评论 -
例题9-6(uva-11400)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-12 20:17:26 · 77 阅读 · 0 评论 -
例题9-5(uva-12563金歌劲曲)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-11 21:20:57 · 87 阅读 · 0 评论 -
例题9-4(uva-116)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-06 11:47:22 · 107 阅读 · 0 评论 -
例题9-3(uva-1347)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-03 10:18:10 · 872 阅读 · 2 评论 -
例题9-2(uva-437)
#include <iostream>#include <vector>#include <stack>#include <list>#include <map>#include <set>#include <deque>#include <queue>#include <cstring>#include <unordered_map>#include <unor原创 2020-10-02 13:25:59 · 88 阅读 · 0 评论 -
例题9-1(uva-1025)
#include <iostream>#include <stdio.h>#include <string.h>using namespace std;int t[56], dp[256][55], has_train[256][56][2];const int INF = 1e9 + 7;int main(){ int n,T,m,d,id = 0; while (scanf_s("%d", &n) != EOF && n原创 2020-10-02 11:12:35 · 85 阅读 · 0 评论