Description
n individuals want to travel, the place to stay is far from the restaurant, you need to drive by, but there is only one car in the hotel
The car can sit for a maximum of three people at a time, and each person drives to the restaurant alone for a[i];
When two or three people take a car together, the time spent is the longest driving time among all of them;
For safety, at least two people are required to drive at a time.
So what is the shortest time it takes to get everyone to the restaurant.
Input
The first line is an integer T, indicating the number of test samples.
The first line of each test sample is a positive integer n, indicating the number of people participating in the tour.
The second line is n positive integers a[i], representing the time when n people drive to restaurant alone;
Data range:2≤n<100000,0<a[i]<100000
Output
For each test sample, a minimum driving time is output.
Each result is on a line.
Sample Input 1
2
2
1 2
4
1 1 1 1
Sample Output 1
2
3
Personal Answer (using language:JAVA) Not necessarily right
public class Main {
public static void main(String[] args) {
System.out.println("Unsolved");
}
}
Welcome to communicate!