import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
int[] result = new int[T];
while (T-- > 0) {
// 英雄个数
int heroNumber = scanner.nextInt();
int[] choiceList = new int[heroNumber];
for (int index = 0; index < heroNumber; index++) {
choiceList[index] = scanner.nextInt();
}
int groupNumber = 0;
Arrays.sort(choiceList);
while (choiceList[heroNumber - 1] != 0 && choiceList[heroNumber - 2] != 0
&& choiceList[heroNumber - 3] != 0) {
choiceList[heroNumber - 1] = choiceList[heroNumber - 1] - 1;
choiceList[heroNumber - 2] = choiceList[heroNumber - 2] - 1;
choiceList[heroNumber - 3] = choiceList[heroNumber - 3] - 1;
groupNumber++;
Arrays.sort(choiceList);
}
result[T] = groupNumber / 2;
}
for (int index = result.length - 1; index >= 0; index--) {
System.out.println(result[index]);
}
}
}
Difficult Player Grouping JAVA 未验证AC
最新推荐文章于 2023-06-07 13:55:36 发布