摘要: 贪心6 1921. 消灭怪物的最大数量 #include <cstdio> #include <iostream> #include <vector> #include <algorithm> using namespace std; class Solution { public: int eli 阅读全文
posted @ 2025-05-16 23:09 _Sylvan 阅读(11) 评论(0) 推荐(0)
摘要: 贪心5 45. 跳跃游戏 II #include <vector> #include <algorithm> using namespace std; class Solution { public: int jump(vector<int> &nums) { int n = nums.size() 阅读全文
posted @ 2025-05-16 21:40 _Sylvan 阅读(12) 评论(0) 推荐(0)
摘要: 贪心4 1675. 数组的最小偏移量 #include <iostream> #include <vector> #include <set> using namespace std; class Solution { public: // 返回数组执行某些操作后可以拥有的最小偏移量 int min 阅读全文
posted @ 2025-05-16 18:50 _Sylvan 阅读(12) 评论(0) 推荐(0)
摘要: 贪心3 581. 最短无序连续子数组 #include <vector> #include <algorithm> #include <limits> using namespace std; class Solution { public: static int findUnsortedSubar 阅读全文
posted @ 2025-05-16 16:52 _Sylvan 阅读(10) 评论(0) 推荐(0)
摘要: 贪心2 LCR 132. 砍竹子 II #include <iostream> using namespace std; class Solution { public: const int MOD = 1e9 + 7; // 快速幂算法,计算 (x^n) % mod long long power 阅读全文
posted @ 2025-05-16 00:44 _Sylvan 阅读(17) 评论(0) 推荐(0)