結果

問題 No.279 木の数え上げ
ユーザー yuki2006yuki2006
提出日時 2015-09-18 15:51:00
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,071 bytes
コンパイル時間 11,958 ms
コンパイル使用メモリ 221,548 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-19 03:23:15
合計ジャッジ時間 13,311 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

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

func main() {
	S := nextLine()
	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 s = bufio.NewScanner(os.Stdin)

func next() string {
	s.Split(bufio.ScanWords)
	s.Scan()
	return s.Text()
}
func nextLine() string {
	s.Split(bufio.ScanLines)
	s.Scan()
	return s.Text()
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}
func nextLong() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}
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