結果

問題 No.267 トランプソート
ユーザー AreTrash
提出日時 2016-05-02 09:17:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 23 ms / 1,000 ms
コード長 587 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 114,300 KB
実行使用メモリ 26,076 KB
最終ジャッジ日時 2024-10-05 02:00:25
合計ジャッジ時間 2,196 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No267_1{
    public class Program{
        public static void Main(string[] args){
            Console.ReadLine();
            var cards = Console.ReadLine().Split(' ');
            var suit = new[]{'D', 'C', 'H', 'S'};
            var num = new[]{'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K'};

            Func<string, int> order = str => Array.IndexOf(suit, str[0]) * 13 + Array.IndexOf(num, str[1]);
            Array.Sort(cards, (s1, s2) => order(s1) - order(s2));
            Console.WriteLine(string.Join(" ", cards));
        }
    }
}
0