bzoj 4004
发布日期:2021-05-06 23:45:42 浏览次数:20 分类:精选文章

本文共 578 字,大约阅读时间需要 1 分钟。

大概写一下吧。。

其实主要判断的思路就是一个高斯消元

你每放一个数进去就消一下

接着维护一个类似于线性基的东西

然后这题要卡精度,开long double和1e-6就好了。。

code:

 

#include
#include
#include
#include
#define esp 1e-6 using namespace std;const int N=505;struct qq{ long double x[N]; int cost;}s[N];int n,m;bool cmp (qq a,qq b){return a.cost
esp) { if (vis[i]==-1) { vis[i]=u; ans++;ans1=ans1+s[u].cost; break; } long double k=s[u].x[i]/s[vis[i]].x[i]; for (int j=i;j<=m;j++) s[u].x[j]=s[u].x[j]-k*s[vis[i]].x[j]; } } } printf("%d %d\n",ans,ans1); return 0;}

 

 

 

 

 

上一篇:bzoj3879: SvT 后缀自动机
下一篇:4917: Hash Killer IV

发表评论

最新留言

不错!
[***.144.177.141]2025年04月11日 18时06分06秒