結果

問題 No.564 背の順
ユーザー CroweaCrowea
提出日時 2019-01-22 20:31:32
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 925 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 68,088 KB
実行使用メモリ 24,112 KB
最終ジャッジ日時 2023-10-14 09:18:11
合計ジャッジ時間 2,358 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
19,984 KB
testcase_01 AC 56 ms
22,028 KB
testcase_02 AC 59 ms
21,936 KB
testcase_03 WA -
testcase_04 AC 60 ms
21,932 KB
testcase_05 AC 60 ms
21,920 KB
testcase_06 AC 57 ms
22,072 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 58 ms
24,004 KB
testcase_10 AC 58 ms
19,972 KB
testcase_11 AC 62 ms
23,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var line = Console.ReadLine().Split(' ');
        var height = int.Parse(line[0]);
        var N = int.Parse(line[1]);
        var list = new List<int>(N) { height };

        for (int i = 0; i < N-1; i++)
            list.Add(int.Parse(Console.ReadLine()));

        list = list.OrderByDescending(x => x).Distinct().ToList();
        int idx = list.IndexOf(height) + 1;

        switch (idx)
        {
            case 1:
                Console.WriteLine("{0}st", idx);
                break;
            case 2:
                Console.WriteLine("{0}nd", idx);
                break;
            case 3:
                Console.WriteLine("{0}rd", idx);
                break;
            default:
                Console.WriteLine("{0}th", idx);
                break;
        }
    }
}

0