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 |
大牛们,帮忙找找错误,谢谢!import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int numberC=scanner.nextInt(); double[]output=new double[numberC]; for(int i=0;i<numberC;i++) { int numberN=scanner.nextInt(); int[]input=new int[numberN]; int sum=0,counter=0; for(int j=0;j<numberN;j++) {input[j]=scanner.nextInt(); sum+=input[j];} for(int k=0;k<numberN;k++) {if(input[k]*numberN>sum)counter++;} output[i]=counter*1000000/numberN/1000000.0; } for(int h=0;h<numberC;h++)System.out.printf("%.3f%c\n",output[h]*100,'%'); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator