結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  tak | 
| 提出日時 | 2018-05-25 01:26:35 | 
| 言語 | F# (F# 4.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 66 ms / 2,000 ms | 
| コード長 | 592 bytes | 
| コンパイル時間 | 9,010 ms | 
| コンパイル使用メモリ | 186,144 KB | 
| 実行使用メモリ | 30,976 KB | 
| 最終ジャッジ日時 | 2024-06-28 17:49:32 | 
| 合計ジャッジ時間 | 10,583 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (252 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
let getLastDig (str:string) = str.ToCharArray() |> Array.last
let(|First|Second|Third|Other|) = function
    | '1' -> First
    | '2' -> Second
    | '3' -> Third
    |  _  -> Other
        
let reformat str =
    match getLastDig str with
    | First  -> str + "st"
    | Second -> str + "nd"
    | Third  -> str + "rd"
    | Other  -> str + "th"
let H,N = let t = stdin.ReadLine().Split() |> Array.map int in t.[0],t.[1]
let Hn = Array.init (N-1) (fun _ -> stdin.ReadLine() |> int)
Hn
|> Array.where(fun x -> x > H)
|> Array.length
|> fun x -> x + 1
|> string
|> reformat
|> printfn "%s"
            
            
            
        