結果

問題 No.227 簡単ポーカー
ユーザー ishowtaishowta
提出日時 2017-11-13 12:35:11
言語 Nim
(2.0.0)
結果
RE  
実行時間 -
コード長 937 bytes
コンパイル時間 3,464 ms
コンパイル使用メモリ 72,620 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 15:26:25
合計ジャッジ時間 4,117 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 95) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated]

ソースコード

diff #

import system, algorithm, tables, sets, lists, deques, intsets, critbits, sequtils, strutils, future
proc `?`[T](tf:bool,p:proc(r:bool):T):T = p(tf)
proc `|`[T](lhs,rhs:T):proc = (proc(r:bool):T = (if r: lhs else: rhs))
proc numin():auto = readLine(stdin).split().map(parseInt)
proc strin():auto = readLine(stdin).split()
proc sort[T](a: openArray[T], order:SortOrder=Ascending):seq[T] = sorted(a, system.cmp, order)
proc group[T](v:seq[T]):seq[ref seq[T]] =
    var list = newSeq[ref seq[T]](0)
    var st = 0
    for i in 0..v.len-1:
        if v[i] != v[i+1]:
            var sec = new(seq[T])
            sec[] = v[st..i]
            list.add(sec)
            st = i+1
    return list

var cv = numin().sort().group().map(x => x[].len).sort().reversed()
if cv[0] == 3 and cv[1] == 2:
    echo "FULL HOUSE"
elif cv[0] == 3:
    echo "THREE CARD"
elif cv[0] == 2 and cv[1] == 2:
    echo "TWO PAIR"
elif cv[0] == 2:
    echo "ONE PAIR"
0