結果
問題 | No.571 3人兄弟(その2) |
ユーザー |
|
提出日時 | 2017-10-07 11:09:32 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 130 ms / 2,000 ms |
コード長 | 1,367 bytes |
コンパイル時間 | 4,002 ms |
コンパイル使用メモリ | 79,640 KB |
実行使用メモリ | 41,464 KB |
最終ジャッジ日時 | 2024-11-17 04:23:45 |
合計ジャッジ時間 | 6,216 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
import java.io.*;import java.util.*;public class Main_yukicoder571 {private static Scanner sc;private static Printer pr;private static void solve() {List<Pair> hw = new ArrayList<>();for (int i = 0; i < 3; i++) {int h = sc.nextInt();int w = sc.nextInt();hw.add(new Pair(h, w, (char)('A' + i)));}Collections.sort(hw);for (Pair e : hw) {pr.println(e.c);}}private static class Pair implements Comparable<Pair> {int a;int b;char c;Pair(int a, int b, char c) {this.a = a;this.b = b;this.c = c;}@Overridepublic int compareTo(Pair o) {if (a == o.a) {return Integer.compare(b, o.b);}return Integer.compare(o.a, a);}@Overridepublic int hashCode() {return Integer.hashCode(a);}@Overridepublic String toString() {// [xxx, xxxx]StringBuilder stmp = new StringBuilder(32);stmp.append('[');stmp.append(a);stmp.append(',');stmp.append(' ');stmp.append(b);stmp.append(']');return stmp.toString();}}// ---------------------------------------------------public static void main(String[] args) {sc = new Scanner(System.in);pr = new Printer(System.out);solve();pr.close();sc.close();}private static class Printer extends PrintWriter {Printer(PrintStream out) {super(out);}}}