![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法实验—动态规划
算法实验—动态规划
MokylinJay
Hello World!
展开
-
SDUTOJ 3358 - 高数Umaru系列(9)——哈士奇
#include<bits/stdc++.h>using namespace std;int main(){ // n为狗数,x为钱数,p为每只狗的价格,m为每只狗的萌值 int n, x, p, m; while(cin>>n>>x){ int dp[110][1010] = {0}; // 当第i条狗被考虑在内时的最优解 for (int i = 1; i <= n; i++){原创 2021-11-27 14:34:26 · 151 阅读 · 0 评论 -
SDUTOJ 2080 - 最长公共子序列问题
#include<bits/stdc++.h>using namespace std;int main(){ char s1[501], s2[501]; while (cin>>s1>>s2){ int n = strlen(s1); int m = strlen(s2); // dp[i][j]表示长度为i和长度为j时,两个序列的最长公共子序列长度 int dp[n+1][m+1]原创 2021-11-27 16:24:04 · 126 阅读 · 0 评论 -
SDUTOJ 1729 - 石子合并问题
#include<bits/stdc++.h>using namespace std;#define inf 0x3f3f3f3fint main(){ int n, k, a[202]; int dp_max[202][202], dp_min[202][202]; cin>>n; memset(dp_max, 0, sizeof(dp_max)); memset(dp_min, 0, sizeof(dp_min)); f原创 2021-11-27 15:54:13 · 196 阅读 · 0 评论 -
SDUTOJ 1725 - 最少硬币问题
#include<bits/stdc++.h>using namespace std;#define INF 9999struct Coins{ int val; int count_num;}coins[15];int main(){ // dp[i]记录找i元所用最少的硬币量 int n, dp[20100], m; cin>>n; for (int i = 1; i <= n; i++){原创 2021-11-27 15:04:34 · 313 阅读 · 0 评论 -
SDUTOJ 1730 - 数字三角形问题
#include<bits/stdc++.h>using namespace std;int main(){ // dp[i][j]存储当前位置到底部的最大和 int n, dp[101][101], a[101][101]; cin>>n; for (int i = 1; i <= n; i++){ for (int j = 1; j <= i; j++){ cin>>a[i][原创 2021-11-27 15:27:45 · 217 阅读 · 0 评论