高斯消元&线性基模板

高斯消元:poj1222

#include 
#include 
#define N 5
#define M 6
#define L 10
using namespace std;
int n,b[L*L],a[L*L][L*L],c[L*L];

inline int read(){
	int s=0; char c=getchar();
	while (c<'0' || c>'9') c=getchar();
	while (c>='0' && c<='9') s=s*10+c-'0',c=getchar();
	return s;
}

inline void mod(int x,int y){
	for (int i=1;i<=N*M;i++)
		a[x][i]^=a[y][i];
	b[x]^=b[y];
}

int main(){
	n=read();
	for (int t=1;t<=n;t++){
		for (int i=1;i<=N;i++)
			for (int j=1;j<=M;j++)
				b[M*(i-1)+j]=read();
		for (int i=1;i<=N;i++)
			for (int j=1;j<=M;j++){
				int x=M*(i-1)+j;
				a[x][x]=1;
				if (i>1) a[x][x-M]=1;
				if (i1) a[x][x-1]=1;
				if (j

线性基:bzoj3150

#include 
#define N 110
#define ll long long
using namespace std;
int n,a[N],c[N],l(-1),z[N],x;
ll ans(0);

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	for (int i=n;i;i--){
		x=a[i];
		for (int j=0;j<=32;j++)
			if ((1<


你可能感兴趣的:(高斯消元&线性基,板子)