結果

問題 No.564 背の順
コンテスト
ユーザー tak
提出日時 2018-05-25 01:26:35
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 592 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,924 ms
コンパイル使用メモリ 208,492 KB
実行使用メモリ 32,896 KB
最終ジャッジ日時 2026-03-17 17:25:54
合計ジャッジ時間 6,215 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (161 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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"
0