結果
| 問題 |
No.436 ccw
|
| コンテスト | |
| ユーザー |
fmhr
|
| 提出日時 | 2016-10-28 22:41:01 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 2,000 ms |
| コード長 | 525 bytes |
| コンパイル時間 | 12,331 ms |
| コンパイル使用メモリ | 239,236 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 05:51:10 |
| 合計ジャッジ時間 | 13,943 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
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
}
fmhr