上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页

2021年1月29日

摘要: https://www.acwing.com/problem/content/1017/ 1 #include<iostream> 2 using namespace std; 3 const int N=110; 4 int w[N][N],f[N][N]; 5 int main(void){ 6 阅读全文
posted @ 2021-01-29 11:22 greenofyu 阅读(44) 评论(0) 推荐(0)

2021年1月28日

摘要: https://www.acwing.com/problem/content/description/422/ 求全排列的字典序的下一个排列 。 可以直接用STL中的next_permutation。 1 #include<iostream> 2 #include<vector> 3 #includ 阅读全文
posted @ 2021-01-28 21:45 greenofyu 阅读(73) 评论(0) 推荐(0)
摘要: 1、DP写法 f [ i ] 表示以 i 结尾的子序列的最长长度。 g [ i ] 表示从尾部出发,以 i 结尾的子序列的最长长度。 那么假设选定 i 为最高点的话,合唱队形人数为f [ i ] + g [ i ] - 1 ,减一是因为 i 算了两次。 1 #include<iostream> 2 阅读全文
posted @ 2021-01-28 15:03 greenofyu 阅读(79) 评论(0) 推荐(0)

2021年1月27日

摘要: 线性DP:在线性空间上进行答案的递推。 1、数字三角形问题 https://www.acwing.com/problem/content/900/ 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 const int 阅读全文
posted @ 2021-01-27 15:13 greenofyu 阅读(112) 评论(0) 推荐(0)

2021年1月26日

摘要: https://www.acwing.com/problem/content/1605/ 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 typedef long long LL; 5 const int N=1 阅读全文
posted @ 2021-01-26 23:20 greenofyu 阅读(161) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/1355/ 性质:最优方案的所有山峰高度一定在[0 , 100]区间内。 所以可以直接枚举最终区间,计算花费,取最小花费即可。 1 #include<iostream> 2 using namespace std; 3 c 阅读全文
posted @ 2021-01-26 11:18 greenofyu 阅读(55) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/1383/ 1 #include<iostream> 2 using namespace std; 3 int main(void){ 4 int n; 5 cin>>n; 6 int res=1; 7 int d2=0, 阅读全文
posted @ 2021-01-26 09:29 greenofyu 阅读(78) 评论(0) 推荐(0)

2021年1月25日

摘要: https://www.acwing.com/problem/content/1373/ 1、暴搜写法超时 1 #include<iostream> 2 using namespace std; 3 const int N=30; 4 int a[N]; 5 int v,n; 6 int res=0 阅读全文
posted @ 2021-01-25 16:50 greenofyu 阅读(70) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/contest/weekly-contest-225/ A:枚举,或者可以找规律 解法一:枚举 1 class Solution { 2 public: 3 bool check(char * a,string& b){ 4 for(int i=0;i 阅读全文
posted @ 2021-01-25 12:39 greenofyu 阅读(69) 评论(0) 推荐(0)

2021年1月21日

摘要: https://www.acwing.com/problem/content/1343/ 按天枚举 1 #include<iostream> 2 using namespace std; 3 int months[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; 阅读全文
posted @ 2021-01-21 15:04 greenofyu 阅读(46) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页