ttkqwe
ttkqwe
全部文章
分类
归档
标签
去牛客网
登录
/
注册
ttkqwe的博客
全部文章
(共9篇)
题解 | #小红的魔法药剂#
解题思路 核心思想 这道题的关键是理解:对于每种药剂,我们需要独立决定是获得红色版本还是蓝色版本。 对于第 i 种药剂,有两种选择: 选择红色版本:成本为 cost[i] 选择蓝色版本:成本为 cost[b_i] + cost[c_i] 这里需要注意的是:合成蓝色药剂的成本是购买两种红色原料的成...
2025-10-24
1
13
题解 | 素数判断
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool is_prime(int n) { if (n <= 1)return false; int m = int(sqr...
2025-10-23
0
14
题解 | #阶乘末尾非零数字#
问题分析 对于较小的 n(如 n ≤ 20),我们可以直接计算出 n! 的值并从后往前找第一个非零数字: long long factorial(long long n) { long long ans = 1; for (int i = 1; i <= n; ++i) { ...
2025-10-23
0
19
题解 | 仰望水面的歪
直线经过两点 A(x_1, y_1, z_1) 与 B(x_2, y_2, z_2) 方向向量为两点间的差: #include <bits/stdc++.h> using namespace std; typedef long long ll; //水平面的高度h //小歪的...
2025-10-22
1
20
题解 | 牛牛学立体
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false), cin.tie(0); int a, b, c...
2025-10-20
0
21
题解 | 计算机内存
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false), cin.tie(0); cout <<...
2025-10-20
0
22
题解 | あなたの蛙が帰っています
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 998244353; // 模数 // 快速幂算法 // 功能:计算 a^b % mod // 原理:利用二进制拆...
2025-10-20
4
30
题解 | 复读机
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false), cin.tie(0); cout <<...
2025-10-19
1
38
题解 | 魔导师晨拥
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); int damage = 2; i...
2025-10-15
1
28