自由的风0450
自由的风0450
全部文章
分类
归档
标签
去牛客网
登录
/
注册
自由的风0450的博客
全部文章
(共125篇)
题解 | 三角形取数(Hard Version)
倒序dp。(i, j) ↓ ↓ ↓(i+1, j) (i+1, j+1) (i+1, j+2)。注意约束|l-r|<=k。 #include <iostream> #include<vector> #include<algorithm> using na...
2026-01-19
0
9
题解 | 阅读理解
遍历每篇短文,对每个单词,将当前短文编号加入其对应的列表(注意去重)。 #include <iostream> #include<unordered_map> #include<vector> #include<string> using namesp...
2026-01-19
0
11
题解 | 小红的回文串
按照匹配规则,双指针检测 #include <iostream> #include<string> using namespace std; void solve(){ string s; cin>>s; int n=s.size(); ...
2026-01-18
0
11
题解 | 元素方碑
能量守恒,但是不能在奇偶之间传递。判断总平均值=奇平均值=偶平均值且为整数 #include <iostream> using namespace std; using ll=long long; bool solve(){ int n; cin>>n; ...
2026-01-18
0
12
题解 | 有趣的区间
注意到:只要区间内有一个奇数,那异或的结果就为奇数。 #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int...
2026-01-17
0
16
题解 | 【模板】拓扑排序
将所有入度为0的顶点入队;遍历队列,将顶点加入拓扑序列,并将相邻顶点入度减1,若为0,则加入队列;若拓扑序列长度等于顶点数n,则输出序列;否则图中存在环,输出-1。 #include <iostream> #include<vector> #include<queue&...
2026-01-16
0
13
题解 | 小A取石子
如果有办法使石子的异或和为0,则先手必胜 #include <iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n,k; ci...
2026-01-15
0
11
题解 | many sum
使用因数贡献法避免枚举,来提高效率 #include <iostream> #include<vector> using namespace std; using ll=long long; int main() { int n,a1,m; cin>&g...
2026-01-14
0
16
题解 | 切题之路
根据题目描述计算,注意题目没给t的范围即可。 #include <iostream> #include<vector> using namespace std; using ll=long long; int main(){ ios::sync_with_stdio(...
2026-01-11
0
23
题解 | 小红的平滑值插值
如果两个相邻数差的绝对值>k,则需要分成<=k的小段,操作次数(d+k-1)/k-1;特别注意,如果原数组的平滑值<k,则只需要操作一次,将平滑值提高到k。 #include <iostream> #include<vector> #include<a...
2026-01-10
0
16
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页