package PAT1006; import java.util.Scanner; public class Main { public static void main(String[] args) { int m; String id, sign, out; String inId = null, outId = null, minSign = null, maxOut = null; Scanner sc = new Scanner(System.in); m = sc.nextInt(); for(int i = 1; i <= m; i++) { id = sc.next(); sign = sc.next(); out = sc.next(); if(i == 1) { inId = id; outId = id; minSign = sign; maxOut = out; } if(sign.compareTo(minSign) < 0) { inId = id; minSign = sign; } if(out.compareTo(maxOut) > 0) { outId = id; maxOut = out; } } System.out.print(inId + " " + outId); } }
PAT1006
最新推荐文章于 2024-06-24 20:07:18 发布