博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[JLOI2015]装备购买
阅读量:4664 次
发布时间:2019-06-09

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

实数的线性基配用高斯消元思想食用

其实这道题是高斯消元的题

但n^3也还是可以,要在膜质数下进行

再加点贪心

#include
#define re return#define inc(i,l,r) for(int i=l;i<=r;++i) using namespace std;template
inline void rd(T&x){ char c;bool f=0; while((c=getchar())<'0'||c>'9')if(c=='-')f=1; x=c^48; while((c=getchar())>='0'&&c<='9')x=x*10+(c^48); if(f)x=-x;}typedef double D;D EPS=1e-4;const int maxn=505;int p[maxn];int cost[maxn],n,m,sum,ans; inline D Fabs(D x){ re x>0?x:-x;}struct node{ D x[maxn]; int cost; inline bool operator<(node c)const { re cost
EPS) { if(!p[j])//加入基 { p[j]=i; ++sum; ans+=a[i].cost; break; } D t=a[i].x[j]/a[p[j]].x[j];//消元 inc(k,j,m) a[i].x[k]-=a[p[j]].x[k]*t; } printf("%d %d",sum,ans); re 0;}
View Code

 

转载于:https://www.cnblogs.com/lsyyy/p/11552757.html

你可能感兴趣的文章
Nginx 独立图片服务器的搭建
查看>>
【原】js实现复制到剪贴板功能,兼容所有浏览器
查看>>
通过Nginx+tomcat+redis实现反向代理 、负载均衡及session同步
查看>>
iOS数据持久化-OC
查看>>
BeanUtils包的学习
查看>>
14.前端路由router-04编程式导航
查看>>
Awstats显示国家地区插件GeoIP安装
查看>>
Binary Tree Maximum Path Sum
查看>>
line,tiggke,fsm,condition,branch,assert coverage
查看>>
实现动态加载一个 JavaScript 资源
查看>>
iOS中push视图的时候,屏幕中间会出现一条灰色的粗线的解决方案
查看>>
[SCSS] Reuse Styles with the SCSS @mixin Directive
查看>>
4. Add override methods to class
查看>>
直播视频插件--sewise player
查看>>
ltp执行过程总结
查看>>
10套免费的响应式布局 Bootstrap 模版
查看>>
Tomcat 性能优化之APR插件安装 -- [转]
查看>>
WebClient 调用api
查看>>
《Spring实战》-2
查看>>
php中静态方法的使用
查看>>