結果

問題 No.279 木の数え上げ
ユーザー yuki2006yuki2006
提出日時 2015-09-18 15:55:50
言語 Go
(1.22.1)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 927 bytes
コンパイル時間 13,381 ms
コンパイル使用メモリ 238,840 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 15:57:18
合計ジャッジ時間 14,534 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

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

func main() {
	S := readLine()
	t := 0
	r := 0
	e := 0
	for _, v := range S {
		switch v{
		case 't': {
			t+=1
		}
		case 'r': {
			r+=1
		}
		case 'e': {
			e+=1
		}
		}

	}
	PrintI(minA(t, r, e/2))
}

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

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

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func minA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = min(s, v)
	}
	return s
}
func PrintI(args ...int) {
	fmt.Println(strings.Join(mapToString(args), " "))
}

func mapToString(arr []int) []string {
	ret := make([]string, len(arr))
	for i := 0; i < len(arr); i++ {
		ret[i] = strconv.Itoa(arr[i])
	}
	return ret
}
0