摘要:#include <cstdio> #include<cstring> #define SMod 1000000007 #define LL long long using namespace std; int n; LL k; struct Matrix { LL m[103][103]; Mat
阅读全文
摘要:#include #include using namespace std; string a,b; inline int in(){ int ans=0; char x=getchar(); while(x'9')x=getchar(); while(x>='0'&&x>a>>b; cout<<a<<endl<<b<<endl; int c,d; c=in();d=in(); co...
阅读全文
摘要:转载于:http://www.tuicool.com/articles/Zb2qYzj 并查集有两个优化。 一、按秩合并 描述:就是在对两个不同子集连接时,按照rank来连,也就是rank低的连在rank高的下面。rank高的做父亲节点。 作用,这样类似维护了一棵树,树是rank高的在上。rank为
阅读全文
摘要:#include<iostream> #include<cstdio> #include<cmath> using namespace std; void quicksort(int a[],int left,int right) { int i,j,base; i=left; j=right; b
阅读全文
摘要:图的m-着色判定问题——给定无向连通图G和m种不同的颜色。用这些颜色为图G的各顶点着色,每个顶点着一种颜色,是否有一种着色法使G中任意相邻的2个顶点着不同颜色? 图的m-着色优化问题——若一个图最少需要m种颜色才能使图中任意相邻的2个顶点着不同颜色,则称这个数m为该图的色数。求一个图的最小色数m的问
阅读全文
摘要:题目背景 为了欣赏教官萌币的可爱表情,某X给他出了一道数学题.. 题目描述 已知m、n为整数,且满足下列两个条件: (1)m、n∈1,2,3,……,k (2)(n^2-m*n-m^2)^2=1 对给定的k,求m^2+n^2的最大值 输入输出格式 输入格式: 只有一行且只有一个正整数:k 输出格式:
阅读全文