結果

問題 No.564 背の順
コンテスト
ユーザー 大谷祐翔
提出日時 2025-12-01 11:37:21
言語 C#
(.NET 10.0.101)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 812 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,117 ms
コンパイル使用メモリ 170,460 KB
実行使用メモリ 188,008 KB
最終ジャッジ日時 2025-12-01 11:37:31
合計ジャッジ時間 9,468 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (116 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #
raw source code

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine()!.Split(' ');
        int myHeight = int.Parse(input[0]);
        int total = int.Parse(input[1]);
        int count = 1;

        for (int i = 0; i < total - 1; i++)
        {
            int height = int.Parse(Console.ReadLine()!);

            if (height > myHeight)
            {
                count++;
            }
        }

        if (count % 10 == 1)
        {
            Console.WriteLine(count + "st");
        }
        else if (count % 10 == 2)
        {
            Console.WriteLine(count + "nd");
        }
        else if (count % 10 == 3)
        {
            Console.WriteLine(count + "rd");
        }
        else
        {
            Console.WriteLine(count + "th");
        }
    }
}
0