結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
fmhr
|
| 提出日時 | 2016-06-25 16:44:13 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 419 bytes |
| コンパイル時間 | 13,975 ms |
| コンパイル使用メモリ | 222,888 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-11 23:19:00 |
| 合計ジャッジ時間 | 14,910 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 9 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
var s string
s = nextLine()
lenS := len(s)
var wCount, ans int
for i := lenS - 1; i >= 0; i-- {
if s[i] == 'w' {
wCount++
} else if s[i] == 'c' && wCount >= 2 {
ans += wCount * (wCount - 1) / 2
}
}
fmt.Println(ans)
}
var sc = bufio.NewScanner(os.Stdin)
func nextLine() string {
sc.Split(bufio.ScanWords)
sc.Scan()
return sc.Text()
}
fmhr