結果
問題 |
No.571 3人兄弟(その2)
|
ユーザー |
|
提出日時 | 2017-10-10 21:51:10 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 1,193 bytes |
コンパイル時間 | 5,017 ms |
コンパイル使用メモリ | 113,380 KB |
実行使用メモリ | 27,144 KB |
最終ジャッジ日時 | 2024-11-17 08:33:50 |
合計ジャッジ時間 | 6,137 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.Collections.Generic; public class yukicoder { public static void Main() { string[] bro = new string[]{"A", "B", "C"}; List<int> Height = new List<int>(); List<int> Weight = new List<int>(); for(int i = 0; i <= 2; i++) { int[] work = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); Height.Add(work[0]); Weight.Add(work[1]); } for(int j = 0; j <= bro.Length - 2; j++) { for(int i = 0; i <= bro.Length - 2; i++) { bool swap = false; if(Height[i] < Height[i + 1]) { swap = true; } else if(Height[i] == Height[i + 1] && Weight[i] > Weight[i + 1]) { swap = true; } if(swap) { string temp1 = bro[i]; bro[i] = bro[i + 1]; bro[i + 1] = temp1; int temp2 = Height[i]; Height[i] = Height[i + 1]; Height[i + 1] = temp2; int temp3 = Weight[i]; Weight[i] = Weight[i + 1]; Weight[i + 1] = temp3; } } } bro.ToList().ForEach(x => Console.WriteLine(x)); } }