結果
問題 | No.587 七対子 |
ユーザー |
![]() |
提出日時 | 2018-08-02 04:39:19 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 14,268 ms |
コンパイル使用メモリ | 188,248 KB |
実行使用メモリ | 31,488 KB |
最終ジャッジ日時 | 2024-07-19 19:54:50 |
合計ジャッジ時間 | 18,055 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (314 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/
ソースコード
let (|Possible|Impossible|) (tup : (char * int)[]) = let getN n = tup |> Array.where(fun (_, b) -> b = n) let num = tup |> Array.length let pair = getN 2 let lonly = getN 1 let pairNum = pair |> Array.length let lonlyNum = lonly |> Array.length if pairNum + lonlyNum = num && lonlyNum = 1 then let key,_ = lonly |> Array.head Possible key else Impossible let S = stdin.ReadLine() S.ToCharArray() |> Array.countBy(fun x -> x) |> function Possible x -> string x | Impossible -> "Impossible" |> printfn "%s"