夜语声烦-
夜语声烦-
全部文章
分类
题解(33)
归档
标签
去牛客网
登录
/
注册
夜语声烦-的博客
全部文章
(共36篇)
题解 | #素数伴侣(基本所有题解都存在问题)#
所有题解基本都有的问题就是认为只有奇数+偶数才能是素数,忽略了1+1和0+2(本题只存在1+1的情况)的情况。 所以类似 4 1 1 2 3 2 1 1 这样的两组数据都会忽略1+1的配对。 所以考虑对奇数从大到小排序,优先配对比1大的奇数,没得配了再用1和偶数配对,最后统计没配对的1的数量,再让...
2025-04-29
1
27
题解 | #小G有一个大树#
#include <iostream> #include <cstring> using namespace std; const int N = 1010; int n; int h[N], e[N], ne[N], idx; int si[N];//每个节点对应的...
C++
2023-03-05
0
316
题解 | #寻找道路#
#include <iostream> #include <cstring> #include <queue> using namespace std; const int N = 10010, M = 2e5 + 10; int n, m, s, t; i...
2023-02-26
0
390
题解 | #[HNOI2015]菜肴制作#
#include <iostream> #include <cstring> #include <queue> #include <vector> using namespace std; const int N = 1e5 + 10; int ...
2023-02-06
1
489
题解 | #矩阵 A×B#
矩阵快速幂模板题 #include <iostream> using namespace std; const int N = 110; int n, m, p; int a[N][N], b[N][N], c[N][N]; int main() { cin >&g...
C++
2022-10-27
0
433
题解 | #Fibonacci 第 n 项#
思路: 由于数据范围过大,所以递推已经无法满足要求,尝试将递推式的运算转换为矩阵的运算 用 fif_ifi 来表示斐波那契数列的第 iii 项 递推式:fi=1×fi−1+1×fi−2f_i = 1\times f_{i-1} + 1 \times f_{i-2}fi=1×fi−1+1×fi−...
C++
2022-10-27
1
320
题解 | #[SCOI2010]序列操作#
没有思路直接上代码 #include <iostream> #include <cstdio> #define lson u << 1 #define rson u << 1 | 1 using namespace std; const int ...
C++
2022-10-09
1
372
题解 | #回型矩阵#
x, y, d = 0, 0, 0 dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] n = int(input()) a = [[0] * n for _ in range(n)]#必须要改变一下定义数组的方式 for i in range(1, n * n + 1)...
Python3
2022-09-28
1
362
题解 | #跳石板#
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10, INF = 0x3f3f3f3f; int n, m; int f[N];//f[i]表示跳到i号石板上所需的最小次数 int main()...
C++
2022-09-25
1
338
题解 | #Mr. Young's Picture Permutations#
Mr. Young's Picture Permutations #include <iostream> #include <cstring> using namespace std; const int N = 31; typedef long long LL; in...
C++
2022-09-22
0
434
首页
上一页
1
2
3
4
下一页
末页