展开全部
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(“请输入所有分数,分数以空格隔开”);
String s = sc.nextLine();
String[] scores = s.split(” “);
int[] arr = new int[scores.length];
for (int i = 0; i < scores.length; i++) {
arr[i] = Integer.parseInt(scores[i]);
}
int max = getMax(arr);
System.out.println(“最高分 = ” + max);
System.out.println(“最低分 = ” + getMin(arr));
System.out.println(“并列最高分的有” + getMaxNumbers(arr, max)+”个”);
}
private static int getMaxNumbers(int[] arr,int max) {
int count = 0;
for (int i : arr) {
if (i== max){
count++;
}
}
return count;
}
private static int getMin(int[] arr) {
int temp=arr[0];
for (int i = 0; i < arr.length; i++) {
if (temp>arr[i]){
temp = arr[i];
}
}
return temp;
}
private static int getMax(int[] arr) {
int temp=arr[0];
for (int i = 0; i < arr.length; i++) {
if (temp
temp = arr[i];
}
}
return temp;
}
}
执行结果62616964757a686964616fe4b893e5b19e31333431373231