| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:哈哈,用double类型就过了!!!In Reply To:哈哈,用double类型就过了!!! Posted by:sza at 2006-02-18 20:09:08 #include <stdio.h>
#include <math.h>
main(){
int i=0,N=0;
double xa=0.0,ya=0.0,xb=0.0,yb=0.0,a=0.0,b=0.0,sumL=0.0,sumLSQU=0.0,tem1=.0,tem2=.0;
double tem;
while(1){
sumL=0.0;
sumLSQU=0.0;
scanf("%d",&N);
if(N==0) break;
scanf("%lf%lf%lf%lf",&xa,&ya,&xb,&yb);
for(i=0;i<N;i++){
scanf("%lf",&tem);
sumL=sumL+tem;
sumLSQU=sumLSQU+tem*tem;
}
a=ya/xa;
b=yb/xb;
tem1=1.0/(a+1.0)-1.0/(b+1.0);
tem2=a/(a+1.0)-b/(b+1.0);
printf("%.3f\n",1.0/1.414213562373095*sumL*sumL/sqrt(tem1*tem1+tem2*tem2)-0.50000*sumLSQU);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator