时间限制:1.0s 内存限制:512.0MB
求出5个字符串中最长的字符串。每个字符串长度在100以内,且全为小写字母。
one two three four five
three
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class 快速排序 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); List<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < n; i++) { int x = sc.nextInt(); list.add(x); } Collections.sort(list); for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } } }
评论 (0)