結果

問題 No.2021 Not A but B
ユーザー ぷら
提出日時 2022-07-29 21:30:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 1,984 ms
コンパイル使用メモリ 193,548 KB
最終ジャッジ日時 2025-01-30 14:56:48
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 2 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    int ans = 1;
    for(int i = 0; i+1 < N; i++) {
        if(S[i] == 'B' && S[i+1] == 'B') {
            continue;
        }
        else {
            ans++;
        }
    }
    cout << ans << endl;
}
0