結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー yukirinyukirin
提出日時 2015-05-15 17:51:30
言語 Go
(1.21.3)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 908 bytes
コンパイル時間 11,949 ms
コンパイル使用メモリ 201,008 KB
実行使用メモリ 5,500 KB
最終ジャッジ日時 2023-09-08 14:27:03
合計ジャッジ時間 13,175 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 7 ms
5,500 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 5 ms
5,496 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 5 ms
5,484 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 5 ms
5,488 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 6 ms
5,488 KB
testcase_19 AC 4 ms
4,380 KB
testcase_20 AC 7 ms
5,500 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 3 ms
4,384 KB
testcase_23 AC 7 ms
5,496 KB
testcase_24 AC 7 ms
5,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var sc = bufio.NewScanner(os.Stdin)

var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}

func nextFloat() float64 {
	f, _ := strconv.ParseFloat(nextLine(), 64)
	return f
}

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	sc.Split(bufio.ScanWords)

	m := [2]int{}
	counter := make(map[int]int)

	readLine()

	for _, v := range strings.Split(readLine(), " ") {
		i, _ := strconv.Atoi(v)
		counter[i]++
	}

	for k, v := range counter {
		if m[1] == v && m[0] < k {
			m[0], m[1] = k, v
		}
		if m[1] < v {
			m[0], m[1] = k, v
		}
	}
	fmt.Println(m[0])
}
0