随笔分类 - CF
摘要:比赛链接 A 题解 知识点:贪心。 对于一个轨道,要么一次性清理,要么一个一个清理。显然,如果行星个数大于直接清理的花费,那么选择直接清理,否则一个一个清理。即 ,其中 表示轨道 的行星个数。 时间复杂度 空间复杂度
阅读全文
摘要:比赛链接 A 题解 知识点:思维,模拟。 发现 串第一个字符是 则只能使用 max , 则只能使用 min ,随后只需要模拟到 串剩余 个字符时停止即可,然后比对两串。 时间复杂度 空间复杂度 代码 #include <bi
阅读全文
摘要:比赛链接 A 题解 知识点:贪心。 先手的一方拥有大于等于对方最大牌的牌即可获胜,所以考虑取两组牌各自的最大值进行比较。 时间复杂度 空间复杂度 代码 #include <bits/stdc++.h> #define ll long long using namespac
阅读全文
摘要:比赛链接 A 题解 知识点:数学。 显然长度大于等于3的数字串的最小数位是完全可以通过这些操作留到最后。 长度等于2的数字串只可能是个位数字。 时间复杂度 空间复杂度 代码 #include <bits/stdc++.h> using namespace std; int
阅读全文
摘要:比赛链接 A 题解 知识点:数学,贪心。 考虑 和 的余数情况。 时间复杂度 空间复杂度 代码 #include <bits/stdc++.h> using namespace std; int main(){ std::ios::sync_wit
阅读全文
摘要:比赛链接 A 题解 知识点:模拟。 照着模拟(细节加0防炸char,虽然这里没用)。 时间复杂度 空间复杂度 代码 #include <bits/stdc++.h> using namespace std; int main(){ std::ios::sync_with_
阅读全文
摘要:比赛链接 A 题解 知识点:模拟。 (比较显然,不写了) 时间复杂度 空间复杂度 代码 #include <bits/stdc++.h> using namespace std; int a[100]; int main(){ std::ios::sync_wit
阅读全文