2022115886
2022115886
全部文章
分类
题解(4)
归档
标签
去牛客网
登录
/
注册
2022115886的博客
全部文章
(共5篇)
题解 | #食物链#
主要考察加权并查集 更加深入的考察并查集知识,在并查集中加入关系域,关系域会随着加入数据的内容进行实时更新。 c++代码如下: #include <bits/stdc++.h> using namespace std; const int N=1e8+7; int n,k; int d,...
C++
C++
2023-08-12
1
473
题解 | #wyh的迷宫#
运用深度优先搜索求路径数问题 代码如下 #include <bits/stdc++.h> using namespace std; int t; int n,m; int mark[505][505]; int dp[505][505]; char a[505][505]; bool f...
C++
深度优先搜索
2023-07-29
2
450
题解 | #赢的次数#
简单的数学题 两者赢的概率都是1/2,那么两者赢的次数无非就是对半分和一个人比另一个人多赢一场,当场次n为偶数时,两个人赢的次数就都是n/2,当场次n为奇数时,就可能是Alice比Bob多赢一场,就是n/2+1,也可能是Alice比Bob少赢一场,就是n/2。代码如下: #include <b...
C++
2023-07-29
5
502
题解 | #多重背包#
背包问题: 起初并未想到二进制优化,因为这一题数据范围不大,因此可以用O(n3)的解法,提交代码如下: include <bits/stdc++.h> using namespace std; int n,t; int x,w,v; int dp[101][1001]; in...
C++
动态规划
2023-07-29
1
442
题解 | #排序#(c++,maopaopaixv)
class Solution { public: vector<int> MySort(vector<int>& arr) { // write code here int len = arr.size();//length...
2023-07-18
1
303