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

啊。。。我倒了。。。各位大虾来瞄下撒,哪里错了,是JAVA的。

Posted by 2009018018 at 2010-07-03 17:16:20 on Problem 1862
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:
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