自由的风0450
自由的风0450
全部文章
分类
归档
标签
去牛客网
登录
/
注册
自由的风0450的博客
全部文章
(共112篇)
题解 | 统计个数
用二维vector存储图的边关系。线的统计:通过三层循环遍历所有有序三元组 (a,b,c),满足 a-b 且 b-c 相连时计数,最后除以 2 去重。三角的统计:遍历无序三元组 (a,b,c)(a<b<c),确保三者两两相连时计数,避免重复。 #include <iostream&...
2026-01-06
0
9
题解 | 完全背包前置题
#include <iostream> #include<vector> using namespace std; int main() { int n,k; cin>>n>>k; vector<int>v(n);...
2025-12-31
0
12
题解 | 小红的01串
经分析发现,仅当‘1’与‘0’的数量均为奇数时无法使所有字符相等。 #include <iostream> #include<string> using namespace std; void solve(){ string s; cin>>s;...
2025-12-31
0
12
题解 | 小q的数列
f(n)即为n的二进制表达式中1的数量,f(n)第一次出现在第2^f(n)-1项 #include <iostream> using namespace std; long long cnt_1(long long n){ long long cnt=0; while(...
2025-12-14
0
19
题解 | 被打乱的异或和
新数组中任何元素都符合题意 #include <iostream> #include<vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr...
2025-12-13
0
18
题解 | 智乃的数字
观察发现智数每过7个增加30。{3,5,9,15,21,25,27}是增加的类循环 #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nu...
2025-12-13
0
18
题解 | 最大子段和
#include <iostream> #include<vector> #include<algorithm> using namespace std; using ll=long long; int main() { ios::sync_with_s...
2025-12-12
0
23
题解 | 撞车
#include <iostream> #include<vector> #include<algorithm> using namespace std; struct car{ int x,v; }; bool compare(const car&am...
2025-12-12
0
16
题解 | 小红的地砖
#include <iostream> #include<vector> #include<algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin...
2025-12-12
0
19
题解 | 小红的密码修改
统计每种字符类型的数量,大于1可替换为其他所有字符,反之只能替换为同类型字符 #include <iostream> #include<string> using namespace std; int gettype(char c){ if(c>='A'&am...
2025-12-12
0
18
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页