結果

問題 No.227 簡単ポーカー
ユーザー chikepluschikeplus
提出日時 2019-01-28 22:32:59
言語 F#
(F# 4.0)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 792 bytes
コンパイル時間 14,922 ms
コンパイル使用メモリ 184,516 KB
実行使用メモリ 31,744 KB
最終ジャッジ日時 2024-04-15 21:55:23
合計ジャッジ時間 8,974 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
31,360 KB
testcase_01 AC 69 ms
31,488 KB
testcase_02 AC 70 ms
31,080 KB
testcase_03 AC 68 ms
31,336 KB
testcase_04 AC 69 ms
31,332 KB
testcase_05 AC 71 ms
31,360 KB
testcase_06 AC 69 ms
31,616 KB
testcase_07 AC 68 ms
31,232 KB
testcase_08 AC 69 ms
31,744 KB
testcase_09 AC 70 ms
31,232 KB
testcase_10 AC 69 ms
31,356 KB
testcase_11 AC 69 ms
31,232 KB
testcase_12 AC 68 ms
31,344 KB
testcase_13 AC 69 ms
31,232 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (367 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.Collections.Generic
open System.Linq
let getArgs = 
    let args = System.Console.ReadLine().Split( ' ' ):string[]
    let dict = new Dictionary<string,int>()
    for i in args do
        match (dict.ContainsKey i) with
        | false -> dict.Add( i , 1)
        | true  -> dict.Item i <- (dict.Item i + 1)
    dict

let Rank (dict:Dictionary<string,int>) = 
    let dictv = dict.Values.OrderByDescending(fun x -> x).ToArray()
    let TryItem x = match Array.tryItem x dictv with
                    | None      -> 1
                    | Some(x)   -> x
    match ( (TryItem 0) , (TryItem 1)) with
    | 3, 2 -> printfn "FULL HOUSE"
    | 3, _ -> printfn "THREE CARD"
    | 2, 2 -> printfn "TWO PAIR"
    | 2, _ -> printfn "ONE PAIR"
    | _, _ -> printfn "NO HAND"

Rank getArgs
0