結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-21 08:27:46 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,414 bytes |
| コンパイル時間 | 967 ms |
| コンパイル使用メモリ | 111,012 KB |
| 実行使用メモリ | 26,136 KB |
| 最終ジャッジ日時 | 2024-11-21 12:20:46 |
| 合計ジャッジ時間 | 1,803 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 RE * 2 |
コンパイルメッセージ
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;
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, 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 );
}
}
}