满加
满加
全部文章
分类
归档
标签
去牛客网
登录
/
注册
满加的博客
全部文章
(共51篇)
题解 | 特殊的科学计数法
C++ #include <iostream> using namespace std; int main() { string i; cin >> i; int a=i[0]-'0', b=i[1]-'0', c=i.size()-1; i...
2025-08-17
0
19
题解 | 九倍平方数
C++ 位数最大1e5所以不能直接除。规律:一个数能被9整除,当且仅当它的各位数字之和能被9整除 #include <array> #include <iostream> #include <vector> using namespace std; int ma...
2025-08-15
0
12
题解 | 元素方碑
C++ 不理解[牛泪]、规律是奇数项平均值为整数且等于所有项的平均值,找不到就寄啦 #include <array> #include <iostream> #include <vector> using namespace std; int main() { ...
2025-08-14
0
12
题解 | 变幻莫测
C++ 主要是找到变换的规律,① (x,y)->(y,x),② (x,y)->(x+y,x-y) 连续两次①或②变换,始终是n*(x, y),除非本来x=y否则不可能,而x=y符合要求,变换次数为0;变换一次②,若x+y=x-y则y=0;变换①后变换②,即y+x=y-x则x=0;变换②①...
2025-08-14
0
16
题解 | 小红的字符串修改
C++ 题中只能把其中一个任意一个字母替换成其在字母表中相邻的字母,所以不是计算最长相同子串的问题 #include <iostream> #include <string> using namespace std; int main() { string s, t...
2025-08-13
0
23
题解 | 田忌赛马
C++ #include <algorithm> #include <array> #include <iostream> using namespace std; int main() { array<int, 3> a; arra...
2025-08-13
0
14
题解 | 大整数哈希
C++中map底层实现是红黑树(平衡二叉搜索树),而unordered_map是哈希表(哈希桶 + 链表 / 红黑树) #include <iostream> // #include <map> // 红黑树 #include <unordered_map> //...
2025-08-12
0
18
题解 | 字符串哈希
C++ 将字符串映射为一个整数,采用基本多项式哈希 #include <iostream> #include <string> #include <vector> using namespace std; // 基本多项式哈希 - 将字符串映射为一个整数 cla...
2025-08-12
0
15
题解 | 【模板】整数优先队列
C++ 通过最小堆(完全二叉树)来实现,O(log n),(或者采用priority_queue #include <array> #include <iostream> #include <type_traits> #include <vector>...
2025-08-11
0
20
题解 | 【模板】多重集合操作
C++为提高查找效率,采用map(底层是红黑树,时间复杂度 O (log n))或multiset #include<bits/stdc++.h> using namespace std; class multiSet { private: map<int, in...
2025-08-11
0
23
首页
上一页
1
2
3
4
5
6
下一页
末页