04 2022 档案
摘要:1.DFS 【1.1】排列数字 #include<iostream> using namespace std; const int N=10; int n; int path[N]; bool st[N]; void dfs(int u) { if(u==n)//到了第n层则输出 { for(int
阅读全文
摘要:一、背包问题 【1.1】01背包 1 for(int i=1;i<=n;i++) 2 for(int j=m;j>=v[i];j--) 3 f[j]=max(f[j],f[j-v[i]]+w[i]); View Code 【1.2】完全背包 1 #include<iostream>//用一维数据f[
阅读全文
摘要:2.5.1vector存放内置数据类型 1 #include<vector> 2 #include<algorithm> 3 #include<iostream> 4 #include<algorithm> 5 using namespace std; 6 7 //vecotr容器存放内置数据类型
阅读全文
摘要:int的数据范围:-2147483648~2147483647[-2^31~2^31-1] long long范围:-922 3372 0368 5477 5808 ~ 922 3372 0368 5477 5807 (922*10^16) 最近做题的时候,经常遇到范围是2^63,取模2^64的这种
阅读全文
摘要:最短路 给定 n 个点 m 条边的有向图,每条边有个边权,代表经过这条边需要花费的时间,我们只能从编号小的点走到编号大的点,问从 1 号点走到 n 号点最少需要花费多少时间? 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N
阅读全文