結果

問題 No.24 数当てゲーム
ユーザー k.hk.h
提出日時 2019-08-03 23:01:10
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 621 bytes
コンパイル時間 14,442 ms
コンパイル使用メモリ 209,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 17:12:49
合計ジャッジ時間 14,334 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())
	m := map[string]int{
		"0": 0,
		"1": 0,
		"2": 0,
		"3": 0,
		"4": 0,
		"5": 0,
		"6": 0,
		"7": 0,
		"8": 0,
		"9": 0,
	}
	for i := 0; i < N; i++ {
		sc.Scan()
		strs := strings.Split(sc.Text(), " ")
		if strs[4] == "YES" {
			for j := 0; j < 4; j++ {
				m[strs[j]]++
			}
		} else {
			for j := 0; j < 4; j++ {
				m[strs[j]]--
			}
		}
	}
	max := m["0"]
	ans := "0"
	for k, v := range m {
		if v > max {
			max = v
			ans = k
		}
	}
	fmt.Println(ans)
}
0