結果

問題 No.571 3人兄弟(その2)
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-07 03:28:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 78,252 KB
実行使用メモリ 54,208 KB
最終ジャッジ日時 2024-04-28 12:06:21
合計ジャッジ時間 4,097 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
52,860 KB
testcase_01 AC 105 ms
53,052 KB
testcase_02 AC 109 ms
54,132 KB
testcase_03 AC 104 ms
52,992 KB
testcase_04 AC 118 ms
54,004 KB
testcase_05 AC 114 ms
53,608 KB
testcase_06 AC 110 ms
53,568 KB
testcase_07 AC 116 ms
54,108 KB
testcase_08 AC 100 ms
52,584 KB
testcase_09 AC 110 ms
54,208 KB
testcase_10 AC 115 ms
54,000 KB
testcase_11 AC 110 ms
53,060 KB
testcase_12 AC 113 ms
54,064 KB
testcase_13 AC 120 ms
54,208 KB
権限があれば一括ダウンロードができます

ソースコード

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