結果

問題 No.564 背の順
ユーザー taktak
提出日時 2018-05-25 01:26:35
言語 F#
(F# 4.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 3,394 ms
コンパイル使用メモリ 158,124 KB
実行使用メモリ 24,892 KB
最終ジャッジ日時 2023-09-11 03:17:26
合計ジャッジ時間 5,223 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
24,892 KB
testcase_01 AC 82 ms
22,840 KB
testcase_02 AC 85 ms
22,848 KB
testcase_03 AC 84 ms
22,680 KB
testcase_04 AC 84 ms
22,864 KB
testcase_05 AC 85 ms
22,924 KB
testcase_06 AC 85 ms
24,720 KB
testcase_07 AC 84 ms
22,908 KB
testcase_08 AC 84 ms
24,888 KB
testcase_09 AC 83 ms
24,860 KB
testcase_10 AC 83 ms
22,776 KB
testcase_11 AC 85 ms
20,872 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

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