摘要: A 题意: 有无限个方块,上面分别是0,1,2.....。若方块i可以被表示为ax+by(x,y>0),则方块为白色,否则为黑色,给出a,b。问黑方块是否有无限个。 分析: 1:若(a,b)=1,由斐蜀等式,则存在an+bm=1(n,m为整数(不保证大于0))。我们只要考虑一个ab区间,若区间内都是 阅读全文
posted @ 2019-11-11 23:39 idyllic 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 图(cactus)。所谓简单回路就是指在图上不重复经过任何一个顶点的回路。 输入的第一行包括两个整数n和m(1≤n≤50000以及0≤m≤10000)。其中n代表顶点个数,我们约定图中的顶点将从1到n编号。接下来一共有m行。代表m条路径。每行的开始有一个整数k(2≤k≤1000),代表在这条路径上的 阅读全文
posted @ 2019-05-09 20:55 idyllic 阅读(1469) 评论(0) 推荐(0) 编辑
摘要: 1:最小生成树 #include<bits/stdc++.h> using namespace std; const int mod=31011; struct mdzz{ int op,ed,v; }e[1010]; struct rbq{ int left,right,va; }a[1010]; 阅读全文
posted @ 2019-05-08 13:14 idyllic 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 动态规划思想的Flord #include<iostream> using namespace std; int d[5000][5000]; int main() { int i,j,n,m,u,v,w,k; cin>>n>>m; for (i=1;i<=n;i++) for (j=1;j<=n; 阅读全文
posted @ 2019-05-07 20:17 idyllic 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 以下都是借来的程序,时间仓促,准备模板用,日后改为自己的。 出处: https://www.cnblogs.com/yanlifneg/p/5432822.htmlhttps://blog.csdn.net/icecab/article/details/82356929 1:堆优化的dij(边非负) 阅读全文
posted @ 2019-05-07 20:09 idyllic 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 拓扑排序:*保证无环 1:模板(若要字典序则采用优先队列) #include<iostream> #include<cstring> #include<queue> int s[100010],f[100010]; int vis[100010]; using namespace std; int 阅读全文
posted @ 2019-05-07 19:26 idyllic 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 1:图的构成:顶点和边(分有向无向) 2:图的基本定理: a):欧拉定理(一笔画定理) b): 握手引理:各顶点度的和等于边的数量和的两倍 推论1:各顶点的度和和一定为偶数 推论2:奇数度顶点一定有偶数个 3:正则图:每个顶点的度均为k则称为k正则图 4:图的存储: a):邻接矩阵 #include 阅读全文
posted @ 2019-05-07 19:07 idyllic 阅读(329) 评论(0) 推荐(0) 编辑