結果

問題 No.436 ccw
ユーザー fmhrfmhr
提出日時 2016-10-28 22:41:01
言語 Go
(1.22.1)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 9,953 ms
コンパイル使用メモリ 202,976 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-15 21:08:28
合計ジャッジ時間 11,566 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 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,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 6 ms
4,384 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 5 ms
4,380 KB
testcase_19 AC 5 ms
4,380 KB
testcase_20 AC 5 ms
4,384 KB
testcase_21 AC 82 ms
4,376 KB
testcase_22 AC 74 ms
4,380 KB
testcase_23 AC 74 ms
4,380 KB
testcase_24 AC 79 ms
4,376 KB
testcase_25 AC 72 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	sc.Split(bufio.ScanWords)
	var s string
	fmt.Scan(&s)
	b := []byte(s)
	var cCnt, wCnt int
	for _, k := range b {
		switch k {
		case 'c':
			cCnt++
		case 'w':
			wCnt++
		}
	}
	cCnt--
	fmt.Println(min(cCnt, wCnt))
	return
}

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

var sc = bufio.NewScanner(os.Stdin)

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

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