結果
| 問題 | No.571 3人兄弟(その2) | 
| コンテスト | |
| ユーザー |  fukusei | 
| 提出日時 | 2018-05-05 16:43:47 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 136 ms / 2,000 ms | 
| コード長 | 1,307 bytes | 
| コンパイル時間 | 2,394 ms | 
| コンパイル使用メモリ | 81,080 KB | 
| 実行使用メモリ | 41,504 KB | 
| 最終ジャッジ日時 | 2024-06-28 01:58:13 | 
| 合計ジャッジ時間 | 4,852 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 12 | 
ソースコード
import java.util.Arrays;
import java.util.Scanner;
class Brother {
	int cm;
	int kg;
	String name;
	public Brother(int cm, int kg ,String name) {
		this.cm = cm;
		this.kg = kg;
		this.name = name;
	}
}
class paiza {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Brother[] brother = new Brother[3];
		boolean check = false;
		Brother tmp;
		//Brother[] sort = new Brother[3];
		String[] index = {"A","B","C"};
		for (int i = 0; i < 3; i++) {
			brother[i] = new Brother(sc.nextInt(),sc.nextInt(),index[i]);
		}
		do {
			check = false;
			if (brother[0].cm == brother[1].cm) {
				if(brother[0].kg > brother[1].kg) {
					tmp = brother[0];
					brother[0] = brother[1];
					brother[1] = tmp;
					check = true;
				}
			}
			
			if (brother[1].cm == brother[2].cm) {
				if(brother[1].kg > brother[2].kg) {
					tmp = brother[1];
					brother[1] = brother[2];
					brother[2] = tmp;
					check = true;
				}
			}
			
			if (brother[0].cm == brother[2].cm) {
				if(brother[0].kg > brother[2].kg) {
					tmp = brother[2];
					brother[2] = brother[0];
					brother[0] = tmp;
					check = true;
				}
			}
		} while (check);
		Arrays.sort( brother, (a,b)-> b.cm - a.cm ); 
		for(int i = 0; i < brother.length; i++) {
			System.out.println(brother[i].name);
		}
	}
}
            
            
            
        