結果
問題 | No.279 木の数え上げ |
ユーザー | yuki2006 |
提出日時 | 2015-09-18 15:55:50 |
言語 | Go (1.21.3) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 927 bytes |
コンパイル時間 | 15,328 ms |
コンパイル使用メモリ | 213,980 KB |
実行使用メモリ | 5,508 KB |
最終ジャッジ日時 | 2023-08-04 17:54:15 |
合計ジャッジ時間 | 14,268 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 5 ms
5,508 KB |
testcase_11 | AC | 3 ms
5,492 KB |
testcase_12 | AC | 5 ms
5,504 KB |
testcase_13 | AC | 2 ms
5,496 KB |
testcase_14 | AC | 5 ms
5,508 KB |
testcase_15 | AC | 5 ms
5,504 KB |
testcase_16 | AC | 4 ms
5,500 KB |
testcase_17 | AC | 5 ms
5,504 KB |
testcase_18 | AC | 4 ms
5,496 KB |
testcase_19 | AC | 5 ms
5,504 KB |
testcase_20 | AC | 6 ms
5,504 KB |
ソースコード
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 }