結果

問題 No.227 簡単ポーカー
ユーザー m mm m
提出日時 2020-12-12 08:14:45
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 11,338 ms
コンパイル使用メモリ 216,336 KB
実行使用メモリ 4,368 KB
最終ジャッジ日時 2023-10-20 01:58:14
合計ジャッジ時間 12,025 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 1 ms
4,368 KB
testcase_04 AC 2 ms
4,368 KB
testcase_05 AC 1 ms
4,368 KB
testcase_06 AC 2 ms
4,368 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,368 KB
testcase_09 AC 1 ms
4,368 KB
testcase_10 AC 1 ms
4,368 KB
testcase_11 AC 1 ms
4,368 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	s := make([]string, 5)
	for i := range s {
		fmt.Scan(&s[i])
	}
	hand := strings.Join(s, "")
	pair := 0
	triplet := 0

	for i := 0; i < 13; i++ {
		j := strconv.Itoa(i + 1)

		if strings.Count(hand, j) != 3 && strings.Count(hand, j) == 2 {
			pair++
		} else if strings.Count(hand, j) == 3 {
			triplet++
		}
	}

	if pair == 1 && triplet == 1 {
		fmt.Println("FULL HOUSE")
	} else if pair == 0 && triplet == 1 {
		fmt.Println("THREE CARD")
	} else if pair == 2 {
		fmt.Println("TWO PAIR")
	} else if pair == 1 && triplet == 0 {
		fmt.Println("ONE PAIR")
	} else {
		fmt.Println("NO HAND")
	}
}
0