結果

問題 No.564 背の順
ユーザー hum_ophum_op
提出日時 2017-10-20 14:46:56
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 727 bytes
コンパイル時間 5,982 ms
コンパイル使用メモリ 158,388 KB
実行使用メモリ 27,840 KB
最終ジャッジ日時 2023-08-13 15:01:59
合計ジャッジ時間 6,748 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 109 ms
23,800 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 108 ms
23,732 KB
testcase_10 AC 108 ms
23,808 KB
testcase_11 AC 106 ms
21,684 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System


let No564 () =
    let IN = Console.ReadLine().Split(' ')
    let H = int <| IN.[0]
    let N = int <| IN.[1]

    let rec ranking (cnt:int) (rank:int) (H:int) (N:int) = 
        if cnt > 0 then
            let T = int <| Console.ReadLine()
            if T <= H && (rank - 1) >= 0 then
                ranking (cnt - 1) (rank - 1) H N
            else if T > N && (rank + 1) < N then
                ranking (cnt - 1) (rank + 1) H N
            else 
                ranking (cnt - 1) rank H N

        else
            rank + 1
    let r = ranking (N - 1) 1 H N
    printf "%A" r
    match r with
    | 1 -> printfn "st"
    | 2 -> printfn "nd"
    | 3 -> printfn "rd"
    | _ -> printfn "th"
 
    ()

No564 ()
0