摘要: 题目传送门 解题思路: f[i][j]表示到(i,j)的方案数,则f[i][j] = f[i-1][j] + f[i][j-1]; 代码: 1 #include<cstdio> 2 #include<iostream> 3 4 using namespace std; 5 6 long long n 阅读全文
posted @ 2019-12-10 22:38 Mr^Simon 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 解题思路: 先搞一遍欧拉筛,然后f[i]表示i的答案,对于1~n的所有素数,都大于其的数的f改一下. AC代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 5 using namespace std; 6 阅读全文
posted @ 2019-12-10 21:56 Mr^Simon 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 解题思路: 其实就是求一遍最长不上升子序列和最长上升子序列 AC代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 5 using namespace std; 6 7 int n,a[100001],f 阅读全文
posted @ 2019-12-10 21:49 Mr^Simon 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 解题思路: 用f[i]表示长度为i的最长上升子序列的最小的末尾. AC代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 5 using namespace std; 6 7 int n,a[100001 阅读全文
posted @ 2019-12-10 21:47 Mr^Simon 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 解题思路: f[i]表示第i个数的组成方案数 AC代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 6 using namespace std; 7 8 int m,f[ 阅读全文
posted @ 2019-12-10 21:43 Mr^Simon 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 解题思路: 背包,因为题目要求分两队,所以其实背包的容量就是题目给的一半. AC代码: 1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 int n,sum,a[101],f[100001]; 7 8 阅读全文
posted @ 2019-12-10 21:41 Mr^Simon 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 解题思路: 题目里有,多重背包. AC代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<map> 4 5 using namespace std; 6 7 int n,m,tot,f[22]; 8 string l; 9 map 阅读全文
posted @ 2019-12-10 21:39 Mr^Simon 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 解题思路: f[i][0]表示到第i个元素将本元素变为1的最佳答案,f[i][1]表示到第i个元素将本元素变为2的最佳答案. AC代码: 1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 int n, 阅读全文
posted @ 2019-12-10 21:37 Mr^Simon 阅读(109) 评论(0) 推荐(0) 编辑