結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
![]() |
提出日時 | 2016-06-25 16:38:36 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 103 ms / 2,000 ms |
コード長 | 281 bytes |
コンパイル時間 | 12,020 ms |
コンパイル使用メモリ | 240,812 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 21:58:09 |
合計ジャッジ時間 | 12,860 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
package main import ( "fmt" ) func main() { var s string fmt.Scan(&s) 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) }