立花泷之介
立花泷之介
全部文章
分类
归档
标签
去牛客网
登录
/
注册
立花泷之介的博客
全部文章
(共56篇)
题解 | 完美异或
这道题最快速的方法就是利用0异或任何数都不会改变任何数的值的性质(0 ^ a = a),得到(n-1)个0异或n = n,n%n=0,所以数组只需要前n-1个数为0,第n个数为1即可解题本人在这里给出自己的方法,虽然很拙笨,但也是自己亲自探索出来的规律(一般通过率高的题都有规律可以利用): ...
2026-03-05
1
76
题解 | 被打乱的异或和
#include <iostream> #include <vector> #include <numeric> using namespace std; // 设原数组是{a. b}, x = a ^ b; // 新数组为{a, b, a^b} // 尝试取数...
2026-03-05
1
57
题解 | 小红的排列构造①
#include <iostream> #include <vector> using namespace std; // 不是质数:最简单的情况就是他是2的倍数,不包括2 // 要是2的倍数,需要奇数位配上奇数,偶数位配上偶数 // 但是有特殊情况:1号位不能从n中选择1...
2026-03-04
1
69
题解 | 构造数对
Silencer76的精华题解实在精妙,x>1时,必定有数对(x,x)满足条件。这里我给出我自己在探索时找到的另外一个规律: #include <cmath> #include <iostream> #include <linux/limits.h> usi...
2026-03-04
1
60
题解 | 茉茉的密码
#include <iostream> #include <unordered_map> #include <vector> using namespace std; int main() { int n; cin >> n; ...
2026-03-04
2
57
题解 | 三角形取数(Hard Version)
#include <algorithm> #include <iostream> #include <vector> long long INF = -1e18; using namespace std; //这道题相比普通version,就是加上了一个偏移量的约...
2026-03-03
2
63
题解 | 最长不下降子序列
在旧的最长子序列长度的基础上,将新的更小的元素放入其中,既保证旧的最长长度得到记录,同时为未来可能出现的更长长度创造可能性 #include <algorithm> #include <iostream> #include <vector> using names...
2026-02-28
1
69
题解 | 撞车
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct car{ int x, v; }; int main() { int n...
2026-02-28
1
86
题解 | mex
这道题目是一道典型的博弈/构造类贪心题,核心在于理解 mex(最小未出现的非负整数)对数组变化的实质影响。核心思路分析我们需要通过操作 ai = max(0, ai - mex)让数组中所有元素相等。情况 A:数组元素已经全部相同此时不需要任何操作,直接输出 0。情况 B:数组元素不全相同,且数组中...
2026-02-27
1
85
题解 | 斐波那契字符串
#include <iostream> #include <vector> using namespace std; const int mod = 1e9+7; const int maxn = 100001; vector<long long > dp(max...
2026-02-27
1
74
首页
上一页
1
2
3
4
5
6
下一页
末页