結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2017-10-18 10:57:27 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 944 bytes |
コンパイル時間 | 928 ms |
コンパイル使用メモリ | 112,488 KB |
実行使用メモリ | 27,308 KB |
最終ジャッジ日時 | 2024-11-18 14:28:06 |
合計ジャッジ時間 | 1,884 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; class Program { public void Solve() { int[] HN = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); int rank = 1; for (int i = 0; i < HN[1] - 1; i++) { int H = int.Parse(Console.ReadLine()); if (HN[0] < H) { rank++; } } var rankStr = rank.ToString(); switch (rankStr.Substring(rankStr.Length - 1)) { case "1": Console.WriteLine(rankStr + "st"); break; case "2": Console.WriteLine(rankStr + "nd"); break; case "3": Console.WriteLine(rankStr + "rd"); break; default: Console.WriteLine(rankStr + "th"); break; } } static void Main() { var solver = new Program(); solver.Solve(); } }