結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-28 22:32:59 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 5,000 ms |
| コード長 | 792 bytes |
| コンパイル時間 | 8,768 ms |
| コンパイル使用メモリ | 185,448 KB |
| 実行使用メモリ | 31,872 KB |
| 最終ジャッジ日時 | 2024-10-06 03:30:37 |
| 合計ジャッジ時間 | 10,735 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (236 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/
ソースコード
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