結果

問題 No.564 背の順
ユーザー huffman56huffman56
提出日時 2023-01-14 10:10:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 1,104 bytes
コンパイル時間 4,441 ms
コンパイル使用メモリ 102,324 KB
実行使用メモリ 24,520 KB
最終ジャッジ日時 2023-08-26 16:53:19
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
22,360 KB
testcase_01 AC 74 ms
22,424 KB
testcase_02 AC 75 ms
24,520 KB
testcase_03 AC 75 ms
22,344 KB
testcase_04 AC 74 ms
22,288 KB
testcase_05 AC 74 ms
22,364 KB
testcase_06 AC 74 ms
20,212 KB
testcase_07 AC 74 ms
22,344 KB
testcase_08 AC 74 ms
22,364 KB
testcase_09 AC 74 ms
22,364 KB
testcase_10 AC 74 ms
22,328 KB
testcase_11 AC 74 ms
24,304 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Numerics;

namespace _0446
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var h = x[0];
            var n = x[1];
            var cnt = 0;

            for (var i = 0; i < n-1; i++)
            {
                var d = int.Parse(Console.ReadLine());

                if (h < d)
                {
                    cnt++;
                }
            }

            var chk = (cnt + 1).ToString();

            if (chk.IndexOf("1",chk.Length-1) != -1)
            {
                Console.WriteLine(chk + "st");
            }
            else if (chk.IndexOf("2",chk.Length-1) != -1)
            {
                Console.WriteLine(chk + "nd");
            }
            else if (chk.IndexOf("3",chk.Length-1) != -1)
            {
                Console.WriteLine(chk + "rd");
            }
            else
            {
                Console.WriteLine(chk + "th");
            }

        }
    }
}
0