結果
| 問題 |
No.39 桁の数字を入れ替え
|
| コンテスト | |
| ユーザー |
fmhr
|
| 提出日時 | 2016-06-25 18:53:51 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 378 bytes |
| コンパイル時間 | 17,686 ms |
| コンパイル使用メモリ | 240,336 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-11 23:19:26 |
| 合計ジャッジ時間 | 12,102 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 19 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
s := nextLine()
lenS := len(s)
var wCount, ans int
for i := lenS - 1; i >= 0; i-- {
if s[i] == 'w' {
wCount++
} else if wCount >= 2 && s[i] == 'c' {
ans += wCount * (wCount - 1) / 2
}
}
fmt.Println(ans)
}
var sc = bufio.NewScanner(os.Stdin)
func nextLine() string {
sc.Scan()
return sc.Text()
}
fmhr