md有毒卡什么精度!!!!
最大线性无关组(线性基)可作为模板。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define eps 1e-5
#define maxn 550
#define double long double
using namespace std;
int n,m,ins[maxn],cnt=,sum=;
struct pnt
{
double x[maxn];
int c;
}p[maxn];
bool cmp(pnt x,pnt y)
{
return x.c<y.c;
}
int main()
{
scanf("%d%d",&n,&m);
for (int i=;i<=n;i++)
for (int j=;j<=m;j++)
scanf("%Lf",&p[i].x[j]);
for (int i=;i<=n;i++)
scanf("%d",&p[i].c);
sort(p+,p+n+,cmp);
for (int i=;i<=n;i++)
for (int j=;j<=m;j++)
{
if (fabs(p[i].x[j])>eps)
{
if (ins[j])
{
double r=p[i].x[j]/p[ins[j]].x[j];
for (int k=j;k<=m;k++)
p[i].x[k]-=p[ins[j]].x[k]*r;
}
else
{
cnt++;sum+=p[i].c;
ins[j]=i;break;
}
}
}
printf("%d %d\n",cnt,sum);
return ;
}