結果

問題 No.564 背の順
ユーザー neko_the_shadowneko_the_shadow
提出日時 2017-10-04 00:59:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 777 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 110,448 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-04-27 23:01:48
合計ジャッジ時間 2,914 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
25,000 KB
testcase_01 AC 24 ms
22,960 KB
testcase_02 AC 25 ms
27,164 KB
testcase_03 AC 24 ms
25,000 KB
testcase_04 AC 24 ms
25,128 KB
testcase_05 AC 25 ms
25,124 KB
testcase_06 AC 26 ms
26,780 KB
testcase_07 AC 25 ms
27,168 KB
testcase_08 AC 25 ms
27,264 KB
testcase_09 AC 25 ms
25,080 KB
testcase_10 AC 25 ms
25,212 KB
testcase_11 AC 26 ms
27,160 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.Text;
using System.Threading.Tasks;


public class Program
{
    static void Main(string[] args)
    {
        var tokens = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var target = tokens[0];
        var n = tokens[1];

        var rank = 1;
        for (int i = 0; i < n - 1; i++)
        {
            var height = int.Parse(Console.ReadLine());
            if (target < height)
            {
                rank++;
            }
        }

        var x = rank % 10;
        var suffix = x == 1 ? "st" :
                     x == 2 ? "nd" :
                     x == 3 ? "rd" : "th";
        var ans = rank.ToString() + suffix;

        Console.WriteLine(ans);
    }
}

0