摘要: 本体考的是前缀和 前缀和可以简单理解为「数列的前n项的和」,是一种重要的预处理方式 点击查看代码 #include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> a(n + 10), s(n 阅读全文
posted @ 2025-10-30 20:03 ha000star 阅读(34) 评论(0) 推荐(0)
摘要: 题目上给出路程与速度,即可算出时间。 由于s与v中的时间单位为分,所以我们直接将8小时换算成分钟(直接8∗60好了)。 由于时间可能大于1天,我们在求出来的分钟数中加上24∗60。 当我们把该时间减去行走时间和垃圾分类后,判断剩下的时间是否大于一天,如果大于一天就减去一天的时间,但你必须向上取整,不 阅读全文
posted @ 2025-10-30 12:49 ha000star 阅读(76) 评论(0) 推荐(0)
摘要: 做法 : 预处理前后缀 + 贪心 点击查看代码 #include <bits/stdc++.h> using namespace std; void solve(){ int n; cin >> n; vector<int> a(n + 10); for(int i = 1; i <= n; i + 阅读全文
posted @ 2025-10-23 14:49 ha000star 阅读(8) 评论(0) 推荐(1)
摘要: 例题:https://ac.nowcoder.com/acm/contest/117503/B 点击查看代码 #include <bits/stdc++.h> using namespace std; const int N = 2e6 + 10; vector<int> v[N]; int dep 阅读全文
posted @ 2025-10-11 16:20 ha000star 阅读(7) 评论(0) 推荐(0)
摘要: 例题:https://acm.hdu.edu.cn/showproblem.php?pid=2586 点击查看代码 #include <bits/stdc++.h> using namespace std; const int N = 40010; vector<int> v[N]; vector< 阅读全文
posted @ 2025-10-10 12:49 ha000star 阅读(11) 评论(0) 推荐(0)
摘要: 点击查看代码 #include <bits/stdc++.h> using namespace std; const int N = 2000001; const int logN = 21; int f[N][logN + 1], lg[N + 1]; //vector<int>可能会爆内存 vo 阅读全文
posted @ 2025-10-09 15:48 ha000star 阅读(9) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/2149/problem/D 点击查看代码 #include <bits/stdc++.h> #define int long long using namespace std; int f(const vector<int> x){ i 阅读全文
posted @ 2025-09-28 17:25 ha000star 阅读(18) 评论(0) 推荐(0)
摘要: 7-1我们欢迎你 !!! 简要题意:输出即可 #include <stdio.h> int main(){ printf("我们欢迎你!!!"); return 0; } #include <bits/stdc++.h> using namespace std; int main(){ cout < 阅读全文
posted @ 2025-09-19 00:11 ha000star 阅读(296) 评论(0) 推荐(1)
摘要: 数论分块 阅读全文
posted @ 2025-07-23 19:56 ha000star 阅读(18) 评论(0) 推荐(0)
摘要: 大象喝水 https://www.luogu.com.cn/problem/B2029?contestId=256076 简单的模拟题,注意单位转换 点击查看代码 #include <bits/stdc++.h> using namespace std; #define pi 3.14 void s 阅读全文
posted @ 2025-07-07 14:44 ha000star 阅读(75) 评论(0) 推荐(1)