結果

問題 No.24 数当てゲーム
ユーザー ゆうPゆうP
提出日時 2024-03-24 21:34:30
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 721 bytes
コンパイル時間 14,056 ms
コンパイル使用メモリ 224,020 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-24 21:35:20
合計ジャッジ時間 18,046 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// No.24 数当てゲーム
package main

import (
	"fmt"
)

type data struct {
	A, B, C, D int
	R          string
}
type list []data

func main() {
	var n int
	fmt.Scan(&n)

	var a, b, c, d int
	var r string
	var l list
	for i := 0; i < n; i++ {
		fmt.Scan(&a, &b, &c, &d, &r)
		l = append(l, data{A: a, B: b, C: c, D: d, R: r})
	}

	maybe := map[int]int{0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0}
	for _, v := range l {
		if v.R == "YES" {
			maybe[v.A]++
			maybe[v.B]++
			maybe[v.C]++
			maybe[v.D]++
		} else { //	if v.R == "NO"
			maybe[v.A]--
			maybe[v.B]--
			maybe[v.C]--
			maybe[v.D]--
		}
	}

	ans := 0
	for k, v := range maybe {
		if maybe[ans] < v {
			ans = k
		}
	}
	fmt.Println(ans)
}
0