結果

問題 No.571 3人兄弟(その2)
ユーザー ohagi_1182
提出日時 2017-10-07 03:28:37
言語 Java
(openjdk 23)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 2,780 ms
コンパイル使用メモリ 78,008 KB
実行使用メモリ 41,660 KB
最終ジャッジ日時 2024-11-17 03:29:06
合計ジャッジ時間 5,076 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder174;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h1 = sc.nextInt(),w1 = sc.nextInt();
		int h2 = sc.nextInt(),w2 = sc.nextInt();
		int h3 = sc.nextInt(),w3 = sc.nextInt();
		Pair[] p = {new Pair(h1, w1, 'A'), new Pair(h2, w2, 'B'), new Pair(h3, w3, 'C')};
		Arrays.sort(p, new Comparator<Pair>() {
			public int compare(Pair p1, Pair p2) {
				if(p2.h == p1.h) {
					return p1.w - p2.w;
				}
				return p2.h - p1.h;
			}
		});
		for(int i = 0 ; i < 3 ; i++) {
			System.out.println(p[i].c);
		}
	}

	public static class Pair {
		int h;
		int w;
		char c;
		Pair(int h, int w, char c) {
			this.h = h;
			this.w = w;
			this.c = c;
		}
	}

}
0