結果

問題 No.2021 Not A but B
ユーザー ID 21712
提出日時 2024-11-18 22:32:59
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 13,201 ms
コンパイル使用メモリ 223,036 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-18 22:33:17
合計ジャッジ時間 17,011 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 8 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import . "fmt"
import . "strings"

func main() {
	var n,s string
	Scan(&n,&s)
	b:=[]byte(s)
	var c int
	if Contains(s,"BB") {
		c++
	}
	for i,x:=range b[1:] {
		y:=b[i]
		if x=='A'||y=='A' {
			c++
		}
		if i+2<len(b) {
			z:=b[i+2]
			if y=='A'&&x!=y&&y!=z {
				c--
			}
		}
	}
	Println(c)
}
0