题解 | #统计成绩#
统计成绩
http://www.nowcoder.com/practice/cad8d946adf64ab3b17a555d68dc0bba
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); double[] score = new double[n]; double sum = 0.0; double dmax = score[0]; double dmin = 100; for(int i=0;i<n;i++) { score[i]=sc.nextDouble(); if(score[i]>dmax) { dmax=score[i]; } if(score[i]<dmin) { dmin=score[i]; } sum+=score[i]; } System.out.printf("%.2f %.2f %.2f",dmax,dmin,sum/n); } }