結果
問題 |
No.564 背の順
|
ユーザー |
|
提出日時 | 2020-03-28 15:37:38 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 809 bytes |
コンパイル時間 | 1,079 ms |
コンパイル使用メモリ | 115,260 KB |
実行使用メモリ | 27,956 KB |
最終ジャッジ日時 | 2025-01-02 11:36:22 |
合計ジャッジ時間 | 2,222 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.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"); } } }