上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 45 下一页
摘要: 这道题的双指针筛选区间方式,和蓝桥杯的那个最大公约数一模一样: #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cstring> #include <string.h> # 阅读全文
posted @ 2024-03-31 20:21 Gold_stein 阅读(14) 评论(0) 推荐(0)
摘要: 双指针做法: 反过来,从后往前看也是一样的: #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #define For(i, j, n) for (int i 阅读全文
posted @ 2024-03-31 19:15 Gold_stein 阅读(13) 评论(0) 推荐(0)
摘要: #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #define For(i, j, n) for(int i = j ; i <= n ; ++i) usin 阅读全文
posted @ 2024-03-28 09:33 Gold_stein 阅读(29) 评论(0) 推荐(0)
摘要: 带权并查集中,dist[]数组可以理解为一个向量,这样子比按照距离来理解更透彻: 优秀学习资料: AcWing 240. 食物链(带权并查集) - AcWing 即d[a]表示向量a->fa[a] 这道题的并查集解法: #include <iostream> #include <stdio.h> # 阅读全文
posted @ 2024-03-25 20:36 Gold_stein 阅读(36) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> #define int long long using namespace std; const int N = 3e6 + 9; int a[N]; char b[N]; signed main() { ios::sync_with_stdio(0 阅读全文
posted @ 2024-03-25 14:22 Gold_stein 阅读(43) 评论(0) 推荐(0)
摘要: 最开始的思路想错了: 把所有是负数段的连成一块,发现下一步会走到这些负数区域的时候,就算出来需要差了多少,然后在当前这个正数块停留一段时间。 但有可能我们当前踩着的这一块正数非常小,导致我们要等很长时间,所以正确的贪心应该是: 记录最大值的位置,先不停往后走,当发现结果变为负数的时候,就算出需要在之 阅读全文
posted @ 2024-03-23 00:25 Gold_stein 阅读(16) 评论(0) 推荐(0)
摘要: MC里面无限水的模型 #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #define For(i, j, n) for(int i = j ; i <= n 阅读全文
posted @ 2024-03-23 00:19 Gold_stein 阅读(28) 评论(0) 推荐(0)
摘要: #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #define For(i, j, n) for(int i = j ; i <= n ; ++i) usin 阅读全文
posted @ 2024-03-22 16:59 Gold_stein 阅读(62) 评论(0) 推荐(0)
摘要: 这道题虽然难度很低,但是细节不少 1.要先处理减,再处理加。因为是先经历了空档期的优先级衰减,然后才有订单带来的优先级提升;先减后加的时候有0这个下限兜底,如果先加后减可能会导致答案偏小。 2.减之后和加之后都要check一下,如果in_cache为true,减完之后小于等于三,但是加了以后又上升到 阅读全文
posted @ 2024-03-19 15:18 Gold_stein 阅读(29) 评论(0) 推荐(0)
摘要: 你好!如果你在 Ubuntu 虚拟机中遇到域名解析失效的问题,我可以提供一些解决方法。请注意,以下方法适用于 VMware 虚拟机中的 Ubuntu。 修改 DNS 设置: 打开终端(命令行)。 输入以下命令以编辑 resolv.conf 文件: sudo vi /etc/resolv.conf 进 阅读全文
posted @ 2024-03-19 09:01 Gold_stein 阅读(2339) 评论(0) 推荐(0)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 45 下一页