java 洛谷 P1012
这应该是蛮快的了
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Test {
public static void main(String[] args){
class SComparetor implements Comparator<String>{
public int compare(String a,String b){
int p = (a + b).compareTo(b + a);
return p;
}
}
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[] strings = new String[n];
for(int t = 0;t < n;t++) strings[t] = sc.next();
Arrays.sort(strings,new SComparetor());
for (int i = strings.length - 1;i >= 0;i--){
System.out.print(strings[i]);
}
}
}