Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我的代码长度竟然排第一了。。。

Posted by tasty at 2016-12-09 14:28:56 on Problem 3555
一般都是垫底:

#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stdio.h>
using namespace std;
double H,R,D1,h1,D2,h2,D,n;
const double pi=acos(-1.),eps=1e-9;
int main()
{
	scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&H,&R,&D1,&h1,&D2,&h2,&D,&n);
	double v,hm,ans,v1,v2,vd,hd;
	v=D*n*n*n/D2;
	hm=pi*R*R*h2/(pi*R*R-n*n);
	hd=pi*R*R*(h1+h2)/(pi*R*R-n*n);
	vd=n*n*hd;
	vd=min(vd,n*n*n);
	if(v<vd-eps&&v<=n*n*hm)
	    ans=h1+h2+v/(pi*R*R);
	else
	{
		v2=n*n*hm;
		v1=(D*n*n*n-D2*v2)/D1;
		if(v1>=0)
		   ans=h1+h2+min(vd,(v1+v2))/(pi*R*R);
		else
			ans=h1+h2+vd/(pi*R*R);
	}
	ans=min(ans,H);
	printf("%.20f\n",ans);
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator