結果

問題 No.571 3人兄弟(その2)
ユーザー qwrtpsfgqwrtpsfg
提出日時 2017-10-10 21:51:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,193 bytes
コンパイル時間 4,308 ms
コンパイル使用メモリ 116,300 KB
実行使用メモリ 27,268 KB
最終ジャッジ日時 2024-04-28 15:29:34
合計ジャッジ時間 4,564 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
25,008 KB
testcase_01 AC 25 ms
25,092 KB
testcase_02 AC 26 ms
25,340 KB
testcase_03 AC 25 ms
25,260 KB
testcase_04 AC 26 ms
25,132 KB
testcase_05 AC 25 ms
25,336 KB
testcase_06 AC 25 ms
25,264 KB
testcase_07 AC 25 ms
23,092 KB
testcase_08 AC 24 ms
24,956 KB
testcase_09 AC 24 ms
25,220 KB
testcase_10 AC 26 ms
25,212 KB
testcase_11 AC 26 ms
25,132 KB
testcase_12 AC 27 ms
27,268 KB
testcase_13 AC 27 ms
27,140 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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));
    }
}
0