結果

問題 No.2021 Not A but B
コンテスト
ユーザー ID 21712
提出日時 2024-11-18 22:28:06
言語 Go
(1.27.0 + ACL)
コンパイル:
/usr/bin/go_c
実行:
./Main
結果
WA  
実行時間 -
コード長 277 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 12,030 ms
コンパイル使用メモリ 276,896 KB
実行使用メモリ 9,924 KB
最終ジャッジ日時 2026-09-26 02:05:16
合計ジャッジ時間 15,519 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other AC * 12 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

import . "fmt"
import . "strings"

func main() {
	var n,s string
	Scan(&n,&s)
	var c int
	if Contains(s,"BB") {
		c++
	}
	for _,x:=range Split(s,"B") {
		if len(x)>1 {
			c+=len(x)-1
		} else {
			c-=len(x)
		}
	}
	c+=Count(s,"AB")
	c+=Count(s,"BA")
	Println(c)
}
0