結果

問題 No.227 簡単ポーカー
ユーザー RinRin
提出日時 2015-09-08 16:19:51
言語 Scheme
(Gauche-0.9.13)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 1,054 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 11,820 KB
最終ジャッジ日時 2023-09-26 10:07:53
合計ジャッジ時間 1,281 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
11,820 KB
testcase_01 AC 20 ms
11,668 KB
testcase_02 AC 19 ms
11,712 KB
testcase_03 AC 19 ms
11,556 KB
testcase_04 AC 20 ms
11,788 KB
testcase_05 AC 19 ms
11,600 KB
testcase_06 AC 20 ms
11,548 KB
testcase_07 AC 19 ms
11,640 KB
testcase_08 AC 19 ms
11,564 KB
testcase_09 AC 20 ms
11,700 KB
testcase_10 AC 19 ms
11,688 KB
testcase_11 AC 18 ms
11,564 KB
testcase_12 AC 19 ms
11,732 KB
testcase_13 AC 18 ms
11,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (System.out.println x)
  (begin
    (display x)
    (newline)
  )
)

(define (CntList cds card)
  (let loop(
            (i 0)
            (Cnt 0)
           )
    (if (= i 5)
        Cnt
        (if (= card (list-ref cds i))
            (loop (+ i 1) (+ Cnt 1))
            (loop (+ i 1) Cnt)
        )
    )
  )
)

(let (
      (cds (sort (list (read) (read) (read) (read) (read)) <))
     )
  (cond
    ((or (and (= (CntList cds (list-ref cds 0)) 3) (= (CntList cds (list-ref cds 3)) 2))
         (and (= (CntList cds (list-ref cds 0)) 2) (= (CntList cds (list-ref cds 3)) 3)))
     (System.out.println "FULL HOUSE"))
    ((or (= (CntList cds (list-ref cds 0)) 3)
         (= (CntList cds (list-ref cds 2)) 3))
     (System.out.println "THREE CARD"))
    ((and (= (CntList cds (list-ref cds 1)) 2) (= (CntList cds (list-ref cds 3)) 2))
     (System.out.println "TWO PAIR"))
    ((or (= (CntList cds (list-ref cds 1)) 2) (= (CntList cds (list-ref cds 3)) 2))
     (System.out.println "ONE PAIR"))
    (else (System.out.println "NO HAND"))
  )
)
0