http://www.lydsy.com/JudgeOnline/problem.php?id=2876
It means nothing at all ...
Or kneel to the great God.
Http://www.cnblogs.com/GerynOhenz/p/4698451.html
#include <cstdio>#include<cstdlib>#include<iostream>#include<fstream>#include<algorithm>#include<cstring>#include<string>#include<cmath>#include<queue>#include<stack>#include<map>#include<utility>#include<Set>#include<bitset>#include<vector>#include<functional>#include<deque>#include<cctype>#include<climits>#include<complex>//#include <bits/stdc++.h> for Cf,uoj, but not for POJ using namespaceStd;typedefLong LongLl;typedefDoubleDb;typedef pair<int,int>Pii;typedef Complex<DB>CP;#defineMmSt (a,v) memset (A,v,sizeof (a))#defineMmcy (A, B) memcpy (A,b,sizeof (a))#defineFill (a,l,r,v) Fill (a+l,a+r+1,v)#defineRe (I,A,B) for (i= (a); i<= (b); i++)#defineRed (i,a,b) for (i= (a); i>= (b); i--)#defineIRE (I,X) for (typedef (X.BEGIN ()) I=x.begin (); I!=x.end (); i++)#defineFi first#defineSe Second#defineM_p (A, B) Make_pair (A, B)#defineSF scanf#definePF printf#defineBoth (k) (1<< (k))Template<classT>inline T Sqr (t x) {returnx*x;} Template<classT>inlinevoidUpmin (T &t,t tmp) {if(t>tmp) t=tmp;} Template<classT>inlinevoidUpmax (T &t,t tmp) {if(t<tmp) t=tmp;}ConstDB eps=1e-Ten; inlineintSGN (DB x) {if(ABS (x) <eps)return 0;return(x>0)?1:-1;}ConstDB Pi=acos (-1.0); inlineintGint () {intres=0;BOOLneg=0;CharZ; for(Z=getchar (); z!=eof && z!='-'&&!isdigit (z); z=GetChar ()); if(z==eof)return 0; if(z=='-') {neg=1; z=GetChar ();} for(; z!=eof && isdigit (z); res=res*Ten+z-'0', z=GetChar ()); return(neg)?-Res:res; }inline ll Gll () {ll res=0;BOOLneg=0;CharZ; for(Z=getchar (); z!=eof && z!='-'&&!isdigit (z); z=GetChar ()); if(z==eof)return 0; if(z=='-') {neg=1; z=GetChar ();} for(; z!=eof && isdigit (z); res=res*Ten+z-'0', z=GetChar ()); return(neg)?-Res:res; }Const intmaxn=10000;intn;db E,S[MAXN+Ten],k[maxn+Ten],tv[maxn+Ten],v[maxn+Ten];D b lambda,ans;inlinevoidCalc_v () {inti; Re (i,1, N) {DB L=0.0, r=1e4; while(l<R) {DB mid= (l+r)/2.0, temp=2.0*K[I]*SQR (Mid) * (mid-Tv[i]); if(SGN (TEMP-LAMBDA) = =0) {V[i]=mid; Break; } if(TEMP<LAMBDA) L=mid;ElseR=mid; }}}inlineintCheck () {inti; DB Res=0.0; Re (i,1, N) Res+=k[i]*sqr (V[i]-tv[i]) *S[i]; returnres<=D; }inlinevoidCalc_ans () {inti;ans=0.0; Re (i,1, N) ans+=s[i]/v[i];} Inlinevoidsolve () {DB L=0.0, r=1e5; while(l+eps<R) {lambda= (l+r)/2.0; Calc_v (); if(check ()) L=lambda;ElseR=Lambda; } calc_v (); Calc_ans (); }intMain () {/*freopen ("bicycling.in", "R", stdin); Freopen ("Bicycling.out", "w", stdout);*/ inti; SF ("%d%lf\n",&n,&E); Re (i,1, N) SF ("%lf%lf%lf\n",&s[i],&k[i],&Tv[i]); Solve (); PF ("%0.8lf\n", ans); return 0; }
View Code
NOI2012 Riding Chuan Zang