上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 27 下一页
摘要: 状态转移方程: \(f(i, j) = min\{s[j] - s[l - 1] + f[i][k] + f[k + 1][j]\} (k = i, i + 1, ..., r - 1)\) 第一种(循环区间长度和左端点) #include<iostream> using namespace std 阅读全文
posted @ 2020-09-11 15:50 yys_c 阅读(152) 评论(0) 推荐(0)
摘要: Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8325 Accepted Submission(s): 4784 Problem Descri 阅读全文
posted @ 2020-09-11 11:21 yys_c 阅读(139) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; const int N = 310; int r, c; int g[N][N]; int f[N][N]; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; int che 阅读全文
posted @ 2020-09-08 21:32 yys_c 阅读(93) 评论(0) 推荐(0)
摘要: 简单版 区间查询 单点修改 树状数组其实就是想了一种办法,用一个新的数组来维护原数组的所有信息,其中这个新数组的单点查询和区间修改都是logn级别的(而原数组的单点查询O(1), 区间修改O(n)) A[1~8]对应的树状数组C[1~8]的构成如图 c[1] = a[1] c[2] = c[1] + 阅读全文
posted @ 2020-09-08 19:20 yys_c 阅读(196) 评论(0) 推荐(0)
摘要: $f(i) = f(i + 1) + f(i + 2) ,st[i] = 0;\ f(i) = 0, st[i] = 1;$ #include<iostream> using namespace std; const int N = 50; int n, m; int st[N], f[N]; in 阅读全文
posted @ 2020-09-08 16:23 yys_c 阅读(109) 评论(0) 推荐(0)
摘要: 之前写的floyd被卡了????? 心态炸裂之dijkstra #include<iostream> #include<cstring> using namespace std; const int N = 510; int g[N][N], cnt[N], nums[N], dist[N], w[ 阅读全文
posted @ 2020-09-08 15:19 yys_c 阅读(134) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstdio> using namespace std; const int N = 200010; int cnt; int n, m; long a[N], b[N]; int main(){ scanf("%d", &n); for(in 阅读全文
posted @ 2020-09-08 12:16 yys_c 阅读(102) 评论(0) 推荐(0)
摘要: 完全背包解法: 为什么想到完全背包变式? 因为划分一个整数n,只能用<= n的数字,并且一个数字可以用无限次,所以是类似于完全背包的问题。 得到状态转移方程: \(f(i, j) = f(i - 1, j) + f(i - 1, j - i) + f(i - 1, j - 2 * i) + ... 阅读全文
posted @ 2020-09-07 10:13 yys_c 阅读(173) 评论(0) 推荐(0)
摘要: 经典dp问题 自上向下dp #include<iostream> #include<cstring> using namespace std; const int N = 510, INF = 0x3f3f3f3f; int f[N][N], a[N][N]; int n; int main(){ 阅读全文
posted @ 2020-09-06 20:14 yys_c 阅读(147) 评论(0) 推荐(0)
摘要: 不设置st出现无限递归的原因: 对于一个x号男生来说,找他的邻接点j,若j已经心有所属,那么会find(match[j]), 会让编号为match[j]的男生重新去找,那么这个男生开始找,如果在他已经匹配到的女生之前没有找到空闲的女生, 或者无法通过find()换一个另外的女生,那么这个男生找到的仍 阅读全文
posted @ 2020-09-06 18:20 yys_c 阅读(134) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 27 下一页