| 记录编号 | 
        265928 | 
        评测结果 | 
        AAAAAAAAAAAAAAAAAAAA | 
    
    
        | 题目名称 | 
        964.[NOI 2012]骑行川藏 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         TenderRun | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        1.900 s  | 
    
    
        | 提交时间 | 
        2016-06-04 21:45:52 | 
        内存使用 | 
        0.62 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int maxn=10010;
double s[maxn],k[maxn],v[maxn];
double E,lam,x[maxn];
int n;
int main(){
#ifndef ONLINE_JUDGE
	freopen("bicycling.in","r",stdin);
	freopen("bicycling.out","w",stdout);
#endif	
	scanf("%d%lf",&n,&E);
	for(int i=1;i<=n;i++){
		scanf("%lf%lf%lf",&s[i],&k[i],&v[i]);
		if(s[i]==0.0)i-=1,n-=1;
	}
	double l=-1000.0,r=0.0,tot;
	for(int t=1;t<=60;t++){
		lam=(l+r)/2.0;tot=0.0;
		for(int i=1;i<=n;i++){
			double lo=max(v[i],0.0),hi=1e20;
			for(int j=1;j<=100;j++){
				double X=(lo+hi)/2.0;
				if(2*lam*k[i]*X*X*(X-v[i])+1>0)
					lo=X;
				else	
					hi=X;
			}
			x[i]=lo;
			tot+=s[i]*k[i]*(x[i]-v[i])*(x[i]-v[i]);
		}
		if(tot>E)
			r=lam;
		else
			l=lam;	
	}
	double ans=0.0;
	for(int i=1;i<=n;i++)
		ans+=s[i]/x[i];
	printf("%.10lf\n",ans);
	return 0;
}