結果

問題 No.564 背の順
ユーザー hum_ophum_op
提出日時 2017-10-20 14:46:56
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 727 bytes
コンパイル時間 6,558 ms
コンパイル使用メモリ 184,900 KB
実行使用メモリ 34,228 KB
最終ジャッジ日時 2024-05-01 07:53:55
合計ジャッジ時間 8,513 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 77 ms
32,000 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 77 ms
32,128 KB
testcase_10 AC 77 ms
32,128 KB
testcase_11 AC 75 ms
31,972 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (227 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/

ソースコード

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