結果

問題 No.587 七対子
ユーザー taktak
提出日時 2018-08-02 04:39:19
言語 F#
(F# 4.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 5,046 ms
コンパイル使用メモリ 157,716 KB
実行使用メモリ 25,076 KB
最終ジャッジ日時 2023-09-27 02:24:47
合計ジャッジ時間 9,283 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
20,800 KB
testcase_01 AC 83 ms
22,936 KB
testcase_02 AC 83 ms
24,820 KB
testcase_03 AC 82 ms
20,856 KB
testcase_04 AC 82 ms
20,708 KB
testcase_05 AC 84 ms
24,988 KB
testcase_06 AC 84 ms
22,852 KB
testcase_07 AC 83 ms
24,732 KB
testcase_08 AC 84 ms
22,948 KB
testcase_09 AC 82 ms
22,852 KB
testcase_10 AC 83 ms
24,964 KB
testcase_11 AC 84 ms
22,844 KB
testcase_12 AC 83 ms
22,852 KB
testcase_13 AC 83 ms
22,840 KB
testcase_14 AC 83 ms
22,772 KB
testcase_15 AC 83 ms
22,848 KB
testcase_16 AC 83 ms
22,860 KB
testcase_17 AC 87 ms
22,852 KB
testcase_18 AC 82 ms
22,840 KB
testcase_19 AC 83 ms
25,076 KB
testcase_20 AC 82 ms
22,840 KB
testcase_21 AC 82 ms
20,852 KB
testcase_22 AC 83 ms
22,932 KB
testcase_23 AC 83 ms
24,936 KB
testcase_24 AC 83 ms
24,812 KB
testcase_25 AC 83 ms
24,808 KB
testcase_26 AC 83 ms
22,840 KB
testcase_27 AC 81 ms
22,688 KB
testcase_28 AC 83 ms
24,744 KB
testcase_29 AC 82 ms
22,924 KB
testcase_30 AC 82 ms
24,804 KB
testcase_31 AC 83 ms
22,756 KB
testcase_32 AC 82 ms
24,800 KB
testcase_33 AC 82 ms
22,808 KB
testcase_34 AC 82 ms
22,932 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

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"
0