結果

問題 No.564 背の順
ユーザー TaK7907TaK7907
提出日時 2017-10-21 08:35:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 1,430 bytes
コンパイル時間 1,212 ms
コンパイル使用メモリ 109,092 KB
実行使用メモリ 25,940 KB
最終ジャッジ日時 2024-05-01 09:06:22
合計ジャッジ時間 1,894 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
23,960 KB
testcase_01 AC 20 ms
21,684 KB
testcase_02 AC 23 ms
25,940 KB
testcase_03 AC 24 ms
23,644 KB
testcase_04 AC 22 ms
23,972 KB
testcase_05 AC 22 ms
23,728 KB
testcase_06 AC 22 ms
23,836 KB
testcase_07 AC 21 ms
24,116 KB
testcase_08 AC 24 ms
23,772 KB
testcase_09 AC 22 ms
24,024 KB
testcase_10 AC 23 ms
25,760 KB
testcase_11 AC 23 ms
24,108 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;

namespace yukicode {
    public class Program {
        public static string Solver(System.IO.TextReader reader) {
            var buffer = reader.ReadLine().Split( ' ' );
            var h = int.Parse( buffer[ 0 ] );
            var n = int.Parse( buffer[ 1 ] );
            var countTallerThanMe = 0;
            for (var i = 0; i != n - 1; ++i) {
                if (int.Parse( reader.ReadLine() ) > h) countTallerThanMe++;
            }
            return MyLib.Ordinalization( countTallerThanMe + 1 );
        }

        private static void Main() {
            Console.WriteLine( Solver( Console.In ) );
        }
    }

    //--- MyLib ---

    public class MyLib {
        public static string Ordinalization(int num) {
            string[] surfix = { "st", "nd", "rd", "th" };
            return string.Format( "{0}{1}", num, 0 < num % 10 && num % 10 <= 4 ? surfix[ num % 10 - 1 ] : surfix[ 3 ] );
        }
        public static List<int> GetIntListFromTextReader(System.IO.TextReader reader, char delimitor) {
            return reader.ReadLine().Split( delimitor ).ToList<string>().ConvertAll<int>( int.Parse );
        }
        public static List<int> GetIntListFromTextReader(System.IO.TextReader reader, char[] delimitors) {
            return reader.ReadLine().Split( delimitors ).ToList<string>().ConvertAll<int>( int.Parse );
        }
    }
}
0