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 |
啊。。。我倒了。。。各位大虾来瞄下撒,哪里错了,是JAVA的。import java.util.*; import java.text.*; public class Main{ private static double Z(double a,double b){ return 2*Math.sqrt(a*b); } public static void main(String args[]){ double result=0; Scanner sn=new Scanner(System.in); DecimalFormat df=new DecimalFormat("#0.000"); int index=sn.nextInt(); Double a[]=new Double[index]; for(int i=0;i<index;i++){ a[i]=sn.nextDouble(); } for(int i=0;i<index;i++){ double temp; for(int j=0;j<index;j++){ if(a[i]<a[j]){temp=a[i];a[i]=a[j];a[j]=temp;} } } for(int i=0;i<index-1;i++){ result=Z(a[i],a[i+1]); } System.out.println(df.format(result)); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator