不要葱花的小饼干很开心
不要葱花的小饼干很开心
全部文章
分类
归档
标签
去牛客网
登录
/
注册
不要葱花的小饼干很开心的博客
全部文章
(共20篇)
题解 | 不重复数字
为降低时间复杂度,本题可采用无序集合保存已出现过的数字。 #include <iostream> #include <unordered_set> #include <algorithm> using namespace std; int main(){ ...
2026-02-05
1
25
题解 | 动态整数集最近值提取
#include <algorithm> #include <iostream> #include <set> using namespace std; int pre(set<int> &s,int x){ ...
2026-02-04
1
21
题解 | 【模板】集合操作
lower_bound 和 upper_bound 的区别std::lower_bound作用: 返回第一个 大于等于 (>=) 指定值的元素的迭代器。如果值存在: 返回该值的第一个位置。如果值不存在: 返回比目标值 大的第一个元素 位置。如果所有元素都小于目标值: 返回 end() 迭代器。...
2026-02-03
1
36
题解 | 参议院投票
此题想到借助两个队列:r_deque记录红帮当前可行动成员的行动次序,d_queue记录黑帮当前可行动成员的行动次序。当两队列均不为空时,获取两队列的队首,若r_deque队首小于d_queue队首,说明当前红帮队头在黑帮队头之前,红帮队头可使黑帮队头出队,同时红帮队头出队后重新入队;若r_dequ...
2026-02-02
1
27
题解 | 验证栈序列
#include <iostream> #include <vector> #include <stack> using namespace std; int main(){ int q,n,m,k,d; cin>>q; for...
2026-01-30
1
35
题解 | 表达式求值
#include <stack> #include <string> class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回表达式的值 ...
2026-01-30
1
29
题解 | 牛牛的考试
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct Option{ string s; char ch; ...
2026-01-27
1
40
题解 | 简写单词
#include <iostream> using namespace std; int main(){ string s; char a; getline(cin,s); //使用getline读取整行字符串,若使用cin>&g...
2026-01-27
1
31
题解 | 约瑟夫环
想到使用两个数组,数组a存储当前还在队中的人员编号,数组b存储某编号人员当前的报数,一旦有人报到m,即让该人出队(使用erase删除数组a中的该人编号)。由于队中最后一人报数后,重新轮到第一人报数,故边界问题要处理好。 #include <iostream> #include <v...
2026-01-24
1
35
题解 | 绕距
#include <iostream> #include <cmath> #include <iomanip> using namespace std; int main(){ int x1,y1,x2,y2; cin>>x1>&...
2026-01-21
1
33
首页
上一页
1
2
下一页
末页