上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
摘要: 题目链接 这题是完全背包问题。背包容量变成了最后的平方和。装进背包的物品为各个平方数。且可以取无限个。 dp[i][j]+=dp[i−k∗k][j−1]。i为平方和。j为由几个数组成的这个平方和。 最后答案为j=1~4的和。 (又是一道看了题解才会的题) #include<cstdio> #incl 阅读全文
posted @ 2021-02-19 20:17 mikku 阅读(52) 评论(0) 推荐(0)
摘要: 题目链接 依旧是01背包问题。(也可以看成是多重背包问题。但反之多重背包问题也是化作01背包来解) 对于到第i朵花,摆j朵花的f[i][j]=f【i-1】【j-a[i]】+f【i-1】【j-a【i】+1】+…+f【i-1】【j-1】。 (dp真的是看一题题解会一题,做一题不会一题nnd) #incl 阅读全文
posted @ 2021-02-19 19:53 mikku 阅读(42) 评论(0) 推荐(0)
摘要: 题目链接 这是一道dp题。 传到一个人手上的情况数等于上一轮传到左边的人的情况数加上传到右边的人的情况数。 即f【i】【j】=f【i-1】【j-1】+f【i+1】【j+1】. 注意一下环的边界。 #include<cstdio> #include<algorithm> #include<cstrin 阅读全文
posted @ 2021-02-19 19:46 mikku 阅读(167) 评论(0) 推荐(0)
摘要: 题目链接 01背包问题。 详见背包九讲。 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; typedef long long ll; int c,h,w[5005],dp[50005]; int 阅读全文
posted @ 2021-02-19 17:50 mikku 阅读(27) 评论(0) 推荐(0)
摘要: 题目链接 本题就是完全背包。直接套用模板即可。 关于完全背包的讲解可以去看背包九讲。 注意开long long。 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; typedef long long 阅读全文
posted @ 2021-02-19 17:39 mikku 阅读(44) 评论(0) 推荐(0)
摘要: exgcd 模板题1(更基础) 模板题 裴蜀定理 夜深人静写算法-初等数论入门 背包九讲.pdf 夜深人静写算法-动态规划入门 阅读全文
posted @ 2021-02-18 14:40 mikku 阅读(28) 评论(0) 推荐(0)
摘要: Problem Description Bruce Force has had an interesting idea how to encode strings. The following is the description of how the encoding is done:Let x1 阅读全文
posted @ 2021-02-17 20:54 mikku 阅读(57) 评论(0) 推荐(0)
摘要: In our daily life we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233333 ... in the same meaning. And here is the quest 阅读全文
posted @ 2021-02-17 19:23 mikku 阅读(49) 评论(0) 推荐(0)
摘要: Problem Description 考虑一个含有 N 个细胞的一维细胞自动机。细胞从 0 到 N-1 标号。每个细胞有一个被表示成一个小于 M 的非负 整数的状态。细胞的状态会在每个整数时刻发生骤变。我们定义 S(i,t) 表示第 i 个细胞在时刻 t 的状态。在 时刻 t+1 的状态被表示为 阅读全文
posted @ 2021-02-17 18:04 mikku 阅读(41) 评论(0) 推荐(0)
摘要: Problem Description Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. Input The input contains exactly one test 阅读全文
posted @ 2021-02-17 15:06 mikku 阅读(40) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页