摘要:
A #include<bits/stdc++.h> using namespace std; int a[200]; void solve(){ int n,k;cin>>n>>k; a[1]=n; for(int j=n-1,i=2;i<=1+(n-1)*2;i+=2,j--){ a[i]=a[i 阅读全文
摘要:
B MST 类似根号分治的思路,点数少的跑Prim,点数大的跑Kruscal 有个坑点是分界点调100过不了,90能卡过去 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5+5; 阅读全文
摘要:
A.给定n*m的矩阵a,构造一个同样大小的矩阵b使得[1,n*m]都出现一次,且b和a在任意位置上都不相等。 特判完无解后循环移位即可。 #include<bits/stdc++.h> using namespace std; int a[12][12]; void solve(){ int n,m 阅读全文
摘要:
A 简单的组合数学。考虑枚举为1的个数的长度为x,则其他数除了最后一位的0外都可以乱填。 对于末尾为1的数,显然每一位都是独立的,单独考虑每一位。 显然只要该位上有一个0即可,经典容斥:减去全为1的这一种情况。 #include<bits/stdc++.h> using namespace std; 阅读全文