摘要: P8601 [蓝桥杯 2013 省 A] 剪格子 dfs P3395 路障 bfs 阅读全文
posted @ 2022-12-30 12:58 Pamper/ 阅读(125) 评论(0) 推荐(0)
摘要: 最大连续字段和问题:一段连续字段和 最大子段和 前后缀分解:登山,合唱队形 我们可以通过前后缀分解来处理两段字段和 预处理g[i],表示1~i中最大的字段和 h[i] 表示i~n中最大的字段和 dp 状态表示:f[i]表示1~i中以i结尾的所有连续子序列的集合的最大值 状态计算: 只含i 区间长度至 阅读全文
posted @ 2023-03-27 00:33 Pamper/ 阅读(21) 评论(0) 推荐(0)
摘要: 洛谷链接 acwing题解 ##法1 动态规划 分析:如果前面的子段加上第i个数是变大的就加上,如果变小则单独成为一个序列 **状态表示:**f[i]表示到i个数字位置的最大子段和的最大值 **状态计算:f[i]分为包含第i个数的子段 和 自己重新开一个子段 状态转移方程: f[i] = max(f 阅读全文
posted @ 2023-02-03 11:56 Pamper/ 阅读(90) 评论(0) 推荐(0)
摘要: P2895 [USACO08FEB]Meteor Shower S #include <iostream> #include <cstring> #include <queue> using namespace std; const int N = 310; int x, y, t; int g[N 阅读全文
posted @ 2022-12-30 18:01 Pamper/ 阅读(22) 评论(0) 推荐(0)
摘要: P3395 路障 bfs #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> using namespace std; const int N = 2010; i 阅读全文
posted @ 2022-12-30 13:52 Pamper/ 阅读(48) 评论(0) 推荐(0)
摘要: [蓝桥杯 2013 省 A] 剪格子 [蓝桥杯 2013 省 A] 剪格子 题目描述 如图 $1$ 所示,$3\times 3$ 的格子中填写了一些整数。 我们沿着图中的红色线剪开,得到两个部分,每个部分的数字和都是 $60$。 本题的要求就是请你编程判定:对给定的 $m\times n$ 的格子中 阅读全文
posted @ 2022-12-30 12:55 Pamper/ 阅读(145) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> using namespace std; const int N = 10; int n; int path[N]; void dfs(int sum, int start, int k) { if(sum == n) 阅读全文
posted @ 2022-12-21 15:34 Pamper/ 阅读(16) 评论(0) 推荐(0)