上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 23 下一页

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 阅读(117) 评论(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 阅读(165) 评论(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 阅读(59) 评论(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 阅读(83) 评论(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 阅读(75) 评论(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 阅读(74) 评论(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 阅读(50) 评论(0) 推荐(0)

2021年1月20日

摘要: https://www.acwing.com/problem/content/1534/ 算法一:hashmap 对于每一个数a,看m-a是否出现过。取其中的a最小的值。 1 #include<iostream> 2 #include<unordered_set> 3 #include<algori 阅读全文
posted @ 2021-01-20 20:36 greenofyu 阅读(126) 评论(0) 推荐(0)

2021年1月18日

摘要: https://www.acwing.com/problem/content/1210/ 贪心,直接枚举源串,若和目标串不同,则进行操作。 两个性质:最多n-1种操作 每种操作执行0次或者1次 1 #include<iostream> 2 using namespace std; 3 void ch 阅读全文
posted @ 2021-01-18 09:42 greenofyu 阅读(76) 评论(0) 推荐(0)
摘要: 考察排序。 https://www.acwing.com/problem/content/431/ 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 const int N=310; 5 struct node{ 阅读全文
posted @ 2021-01-18 09:25 greenofyu 阅读(59) 评论(0) 推荐(0)
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 23 下一页