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.text.DecimalFormat; import java.util.*; import java.math.*; public class aa { public static void main(String[] args) { Scanner cin=new Scanner(System.in); int N=cin.nextInt(),i,j; double []a=new double[N+1]; for(i=0;i<N;i++) a[i]=cin.nextDouble(); for(i=0;i<N;i++) for(j=i+1;j<N;j++) if(a[i]>a[j]) { double temp=a[i]; a[i]=a[j]; a[j]=temp; } // for(i=0;i<N;i++) //System.out.println(a[i]); double result=a[N-1]; for(i=N-2;i>0;i--) { result=2*Math.sqrt(result*a[i]); } String parten = "#0.000"; DecimalFormat decimal = new DecimalFormat(parten); String re = decimal.format(result); System.out.println(re); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator