結果

問題 No.571 3人兄弟(その2)
ユーザー qwrtpsfgqwrtpsfg
提出日時 2017-10-10 21:51:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 1,193 bytes
コンパイル時間 4,677 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 23,960 KB
最終ジャッジ日時 2023-08-10 22:30:09
合計ジャッジ時間 6,699 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,980 KB
testcase_01 AC 57 ms
23,904 KB
testcase_02 AC 58 ms
21,820 KB
testcase_03 AC 59 ms
22,004 KB
testcase_04 AC 59 ms
19,876 KB
testcase_05 AC 59 ms
21,924 KB
testcase_06 AC 59 ms
21,896 KB
testcase_07 AC 59 ms
21,788 KB
testcase_08 AC 60 ms
23,960 KB
testcase_09 AC 60 ms
21,812 KB
testcase_10 AC 59 ms
23,872 KB
testcase_11 AC 60 ms
21,876 KB
testcase_12 AC 59 ms
21,920 KB
testcase_13 AC 58 ms
23,844 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