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

大牛们,帮忙找找错误,谢谢!

Posted by loveKid at 2008-12-16 23:37:05 on Problem 2350
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:
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