HDACM1678
排序一下,从大到小累加 水….
import java.util.Arrays;
import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc = new Scanner(System.in);int t = sc.nextInt();while(t-->0){int n = sc.nextInt();int price[] = new int[n];for (int i = 0; i < price.length; i++) {price[i]=sc.nextInt();}Arrays.sort(price);int ans = 0;for (int i=price.length-3;i>=0;i=i-3) {ans += price[i];}System.out.println(ans);}sc.close();}
}