篮球队首发阵容选择算法
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class Main {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
static Scanner input = new Scanner(System.in);
public static void main(String[] args) throws IOException {
int[][] aa = new int[20][5];
for (int i = 0; i < 20; i++) {
input.nextInt();
for (int j = 0; j < 5; j++) {
aa[i][j] = input.nextInt();
}
}
int maxAthleticGrade = 0;
for (int a = 0; a < 20; a++) {
for (int b = 0; b < 20; b++) {
for (int c = 0; c < 20; c++) {
for (int d = 0; d < 20; d++) {
for (int e = 0; e < 20; e++) {
if (a != b && a != c && a != d && a != e && b != c && b != d && b != e && c != d && c != e
&& d != e) {
int temp = aa[a][0] + aa[b][1] + aa[c][2] + aa[d][3] + aa[e][4];
maxAthleticGrade = maxAthleticGrade > temp ? maxAthleticGrade : temp;
}
}
}
}
}
}
System.out.println(maxAthleticGrade);
}
}