結果

問題 No.564 背の順
ユーザー phspls
提出日時 2020-03-28 15:34:54
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 823 bytes
コンパイル時間 1,165 ms
コンパイル使用メモリ 110,792 KB
実行使用メモリ 27,984 KB
最終ジャッジ日時 2025-01-02 11:35:30
合計ジャッジ時間 2,468 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;

public class P0564 {
    public static void Main() {
        var hn = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList();
        var h = hn[0];
        var n = hn[1];
        var heights = new List<int>();
        heights.Add(h);
        for(int i=1; i<n; i++) {
            heights.Add(int.Parse(Console.ReadLine().Trim()));
        }
        heights.Sort();
        var takashi = n - heights.IndexOf(h);
        if (takashi < 4) {
            if (takashi==1) {
                Console.WriteLine("1st");
            } else if(takashi==2) {
                Console.WriteLine("2nd");
            } else {
                Console.WriteLine("3rd");
            }
        } else {
            Console.WriteLine(takashi + "th");
        }
    }
}
0