
笔记
bonely
这个作者很懒,什么都没留下…
展开
-
springboot笔记总结
springboot的简单内容笔记原创 2022-09-15 15:13:54 · 515 阅读 · 0 评论 -
组合数学(持续更新)
文章目录排列与组合四个基本计数原理集合的排列排列与组合四个基本计数原理(1)(1)(1) 加法原理: 设集合 SSS 被划分成两两不相交的部分 S1S_1S1, S2S_2S2 … SmS_mSm, 则 SSS的对象数目可以通过确定它的每一个部分的对象数目并如此相加而得到 :∣S∣=∣S1∣+∣S2∣+...+∣Sm∣{\vert S \vert} = {\vert S_1 \vert} + {\vert S_2 \vert} +...+ {\vert S_m \vert}∣S∣=原创 2021-09-03 22:23:12 · 1190 阅读 · 4 评论 -
2021牛客暑期多校训练营3
文章目录B--Black and whiteE--MathJ--Counting TrianglesB–Black and white题目链接:题解:#include<bits/stdc++.h>#define ll long longusing namespace std;const int maxn = 5005;struct node { int u,v; ll w; bool operator < (const node&原创 2021-07-31 23:55:03 · 115 阅读 · 0 评论 -
2021牛客暑期多校训练营4
题目:题目链接题意:LCS(s1,s2)LCS(s1,s2)LCS(s1,s2)表示 s1s1s1 和 s2s2s2 的最长公共子序列给定三个字符串 s1s1s1, s2s2s2,s3s3s3,要求满足 LCS(s1,s2)=aLCS(s1,s2) = aLCS(s1,s2)=a, LCS(s2,s3)=bLCS(s2,s3) = bLCS(s2,s3)=b, LCS(s1,s3)=cLCS(s1,s3) = cLCS(s1,s3)=c输出满足要求的 s1,s2,s3s1,s2,s3s1,s2原创 2021-07-31 13:54:45 · 133 阅读 · 0 评论 -
2021牛客暑期多校训练营2
文章目录C--Draw GridsD--Er Ba GameC–Draw Grids题目链接:题意:总共有 n∗mn*mn∗m 个点, 两人轮流选取两个点连一条线, 不能连已经连过的线, 并且连成的图形不能形成闭合回路, 两人都选取最优策略,最后不能操作的人输题解:判断奇偶性就好#include <bits/stdc++.h>using namespace std;int main(){ int n,m; cin>>n>>m原创 2021-07-25 23:11:58 · 158 阅读 · 1 评论 -
2021牛客暑期多校训练营1
文章目录Alice and BobBall Dropping在补了....Alice and Bob题目链接:题意:总共有两堆石头,每次可以从一堆中取走 kkk (k>0)(k>0)(k>0)块石头,从另一堆取走 s∗ks*ks∗k (s>=0)(s>=0)(s>=0)块石头, 不能操作的人输题解:用一个二维数组 f[i][j]f[i][j]f[i][j] 储存状态, f[i][j]f[i][j]f[i][j] 为 111 代表有两堆石头分别有i原创 2021-07-23 22:12:46 · 178 阅读 · 0 评论 -
I love exam
题目:题目链接:题解:参考:链接:f[i][j]f[i][j]f[i][j] 表示第 iii 门课程,花费 jjj 天可以得到的最大分数dp[i][j][k]dp[i][j][k]dp[i][j][k] 表示前 iii 门课,花费 jjj 天, 挂 kkk 门课可以得到的最大分数记得初始化转移:f[i][z]<60f[i][z]<60f[i][z]<60dp[i][j][k]=max(dp[i][j][k],dp[i−1][j−z][k−1]+f[i][z])dp[i][原创 2021-07-23 17:59:24 · 155 阅读 · 0 评论 -
KD-Graph
题目:链接题意:总共有 nnn 个点,mmm条边,要分成 kkk 组,满足(1)(1)(1) 如果顶点 p 和 q ( p ≠ q ) 在同一组中,则 p 和 q 之间必须至少有一条路径满足该路径中的最大值小于或等于 D。(2)(2)(2) 如果顶点 p 和 q ( p ≠ q ) 在不同的组中,则 p 和 q 之间不可能有任何路径满足该路径中的最大值小于或等于 D。题解:最开始分为cnt=ncnt=ncnt=n个组按找点的边权从小到大排序, 如果这两个点不在同一个集合中,则将它们合并到一个原创 2021-07-23 16:32:53 · 174 阅读 · 0 评论 -
程序自动分析
题目:题解:离散化加上并查集#include <bits/stdc++.h>using namespace std;const int N=2e5+10;int con;unordered_map<long long ,long long>s;int p[N];struct node { int x,y,e;}q[N];int find(int x){ if(p[x]!=x) p[x]=find(p[x]); return p[x];原创 2021-04-29 22:26:53 · 162 阅读 · 0 评论 -
最短网络
题目:题解:prim#include <bits/stdc++.h>using namespace std;int pos[105][105],dis[105],vis[105];int n;int inf=0x3f3f3f3f;int prim(){ memset(dis,inf,sizeof(dis)); int res=0; for(int i=0;i<n;i++) { int t=-1; for(i原创 2021-04-29 22:25:04 · 158 阅读 · 0 评论 -
Bone Collector
题解:01背包#include <bits/stdc++.h>using namespace std;long long f[1105];long long v[1100];long long w[1100];int main(){ int t; cin>>t; while(t--) { memset(f,0,sizeof(f)); int n,m; cin>>n>>m; for(int i=1;i<=n;i++)原创 2021-04-01 21:13:07 · 98 阅读 · 0 评论 -
Buns
题目:Lavrenty, a baker, is going to make several buns with stuffings and sell them.Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuff原创 2021-04-01 21:11:48 · 121 阅读 · 0 评论 -
Bone Collector
题目:Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave …The bone collector had a big bag with a volume of V ,and along his trip原创 2021-04-01 21:05:06 · 85 阅读 · 0 评论 -
Codeforces Round #710 (Div. 3) D. Epic Transformation
题解:存在优先队列里面#include <bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; while(t--) { map<long long,int> a; int n; cin>>n; for(int i=0;i<n;i++) { long long b; scanf("%lld",&b); a[b]++; }原创 2021-03-30 23:22:45 · 158 阅读 · 0 评论 -
Codeforces Round #710 (Div. 3) D. Epic Transformation
题目:You are given an array a of length n consisting of integers. You can apply the following operation, consisting of several steps, on the array a zero or more times:you select two different numbers in the array ai and aj;you remove i-th and j-th elemen原创 2021-03-30 22:30:21 · 89 阅读 · 0 评论 -
新生赛—A
题目:思路:将两段字符串都使用哈希表重新定义,并储存下标,之后使用二分来查找在l,r区间内有几个符合暗号原创 2021-03-29 14:35:46 · 100 阅读 · 0 评论 -
新生赛---L
题目:题解:原创 2021-03-29 14:26:03 · 80 阅读 · 0 评论 -
二叉树的性质
**1:**二叉树的第i层上至多有2的i-1次方个结点**2:**深度为k的二叉树至多有2的k次方-1个结点**3:**对于一颗二叉树T,如果其终端结点数为n0,度为2的结点数为n2,则n0=n2+1**4:**具有n个结点的完全二叉树的深度为[log2,n]+1**5:**一个结点i,它的左孩子是2×i,右孩子为2×i+1...原创 2021-03-17 14:41:01 · 77 阅读 · 0 评论 -
Codeforces Subsequences
题目:Karl likes Codeforces and subsequences. He wants to find a string of lowercase English letters that contains at least k subsequences codeforces. Out of all possible strings, Karl wants to find a shortest one.Formally, a codeforces subsequence of a str原创 2021-03-10 21:42:33 · 173 阅读 · 0 评论 -
树状数组 1 :单点修改,区间查询
题目:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>#include<queue>#include<stack>#include<string>#include<map>#include<sstream&原创 2021-03-10 21:23:32 · 143 阅读 · 0 评论 -
Eddy‘s AC难题
题目:题解:因为每次选部分人,所以从2个人选到有n个人,是组合数c(m,n)第二步,要使一组的最小的大于另外一组最大的,所以就是从一个数分隔例如所以是插板法即 i-1#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>#include<queue原创 2021-03-10 19:59:12 · 92 阅读 · 0 评论 -
Who‘s in the Middle
题目:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<algorithm>#include<queue>#include<stack>#include<string>#include<map>#include<sstream&原创 2021-03-10 19:21:55 · 139 阅读 · 0 评论 -
约数之和
题目:题解:#include <bits/stdc++.h>#define int long longusing namespace std;int a[105];int mod=1e9+7;map<int,int> m;int ans=1;void init(int n){ for(int i=1;i<=n;i++) { for(int j=2;j<=a[i]/j;j++) { while(a[i]%j==0) {原创 2021-03-09 11:41:26 · 121 阅读 · 0 评论 -
约数个数
题目:题解:#include <bits/stdc++.h>#define int long longusing namespace std;int a[105];int mod=1e9+7;map<int,int> m;int ans=1;void init(int n){ for(int i=1;i<=n;i++) { for(int j=2;j<=a[i]/j;j++) { while(a[i]%j==0) {原创 2021-03-09 11:40:23 · 87 阅读 · 0 评论 -
数组模拟链表
单链表:#include <bits/stdc++.h>using namespace std;int head=-1,idx=0,e[100005],ne[100005];void add_head(int x){ e[idx]=x; ne[idx]=head; head=idx; idx++;}void remove(int k){ if(k==0) head=ne[head]; else ne[k-1]=ne[ne[k-1]];}void add(i原创 2021-03-08 23:04:56 · 118 阅读 · 0 评论 -
01背包问题
题目:题解:#include <bits/stdc++.h>using namespace std;int v[1005],w[1005];int f[1005][1005];int main(){ int n,m; cin>>n>>m; for(int i=1;i<=n;i++) cin>>v[i]>>w[i]; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j+原创 2021-03-08 22:57:32 · 91 阅读 · 0 评论 -
数论基础
1.模运算*做减法时候为了避免出现负数,需要(a-b)mod m=((a mod m)-(b mod m)+m) mod m*除法取模需要逆元2.快速幂第一种:long long fastpow1(long long a,long long n){ if(n==1) return a; long long tmp =fastpow(a,n/2); if(n%2==1) return tmp*tmp*a; else return tmp*tmp;}第二种:long long f原创 2021-03-08 22:27:50 · 189 阅读 · 0 评论 -
求组合数2
题目:#include<iostream>using namespace std;const int mod=1e9+7;long long fac[100005],infac[100005];int pow(int a, int k, int p){ int res = 1; while (k) { if (k & 1) res = (long long)res * a % p; a = (long long)a *原创 2021-03-04 22:51:29 · 82 阅读 · 1 评论 -
求组合数1
题目:思路:#include <bits/stdc++.h>using namespace std;long long mod=1e9+7;int c[2005][2005];int main(){ for(int i=0;i<=2000;i++) { for(int j=0;j<=i;j++) { if(!j) c[i][j]=1; else c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod; } } int原创 2021-03-04 22:39:33 · 84 阅读 · 1 评论 -
trie树的基本思路
用处:储存多个字符串思路:例如储存如下并且在储存的时候标记每一个单词到哪里结束原创 2021-02-25 22:14:37 · 86 阅读 · 0 评论 -
KMP基本思路
用处:在一段文本串中寻找另一端模板串思路:例如当匹配到不相等时候如图查看从不相等的那个字母开始的前一段字符串,发现存在相等的前缀和后缀,于是直接移动这个位置而next数组找的便是模板串的每一个字母前一段字符串的最长等的前缀后缀...原创 2021-02-25 22:07:20 · 97 阅读 · 0 评论 -
归并排序
步骤:1确定分界点mid(mid=l+r>>1)2递归3合二为一两段所指的数字作比较,比较完以后挪到下一位继续比较,例如首先1与2作比较,1<2,得到的较小数字存入一个新的数组里面(升序排序),第一段指针后移一位,如下如上继续进行比较,当两个数相同时,任意存入一端即可。如一端到达结尾,另一端还没有结束,结束循环后需要把剩下的继续存入新的数组里面。最后把新数组的里的数字赋值给最开始的数组即可。上代码!#include <bits/stdc++.h>usi原创 2021-02-04 00:14:26 · 92 阅读 · 0 评论