Loading

摘要: 题目链接 https://www.luogu.com.cn/problem/P1518 题目思路 模拟农夫和奶牛行动路线,为了避免死循环,当ans到一定值时跳出 题目代码 #include <iostream> #include <algorithm> using namespace std; ch 阅读全文
posted @ 2022-03-13 20:45 vacilie 阅读(110) 评论(0) 推荐(0)
摘要: 题目链接 https://www.acwing.com/problem/content/4316/ 题目思路 贪心 从最底层向高层遍历,同一分支的两个结点比较,将大值赋给父节点, ans += 最大值 + 最小值 #include <iostream> #include <algorithm> #i 阅读全文
posted @ 2022-03-13 19:56 vacilie 阅读(16) 评论(0) 推荐(0)
摘要: 题目链接 https://www.acwing.com/problem/content/4315/ 题目思路 KMP算法,再通过查询子串来计算出现次数 题目代码 #include <iostream> #include <algorithm> using namespace std; const i 阅读全文
posted @ 2022-03-13 17:28 vacilie 阅读(23) 评论(0) 推荐(0)