結果

問題 No.564 背の順
ユーザー phsplsphspls
提出日時 2020-03-28 15:37:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 2,163 ms
コンパイル使用メモリ 103,616 KB
実行使用メモリ 23,820 KB
最終ジャッジ日時 2023-08-30 17:54:26
合計ジャッジ時間 3,621 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
23,696 KB
testcase_01 AC 61 ms
21,636 KB
testcase_02 AC 63 ms
23,644 KB
testcase_03 AC 64 ms
21,772 KB
testcase_04 AC 62 ms
21,760 KB
testcase_05 AC 65 ms
21,824 KB
testcase_06 AC 64 ms
21,820 KB
testcase_07 AC 64 ms
21,884 KB
testcase_08 AC 64 ms
23,700 KB
testcase_09 AC 62 ms
21,888 KB
testcase_10 AC 63 ms
23,820 KB
testcase_11 AC 63 ms
23,780 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;

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(takashi + "st");
        } else if(takashi%10==2) {
            Console.WriteLine(takashi + "nd");
        } else if(takashi%10==3) {
            Console.WriteLine(takashi + "rd");
        } else {
            Console.WriteLine(takashi + "th");
        }
    }
}
0