結果

問題 No.564 背の順
ユーザー phspls
提出日時 2020-03-28 15:36:51
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 3,595 ms
コンパイル使用メモリ 115,364 KB
実行使用メモリ 27,972 KB
最終ジャッジ日時 2025-01-02 11:36:09
合計ジャッジ時間 2,357 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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%10==1) {
            Console.WriteLine("1st");
        } else if(takashi%10==2) {
            Console.WriteLine("2nd");
        } else if(takashi%10==3) {
            Console.WriteLine("3rd");
        } else {
            Console.WriteLine(takashi + "th");
        }
    }
}
0