結果

問題 No.2894 Monotonic Intervals
ユーザー 憩いの場
提出日時 2024-09-20 21:22:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 192,500 KB
最終ジャッジ日時 2025-02-24 09:48:53
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

int main( void )
{
    int N;
    cin >> N;
    string S;
    cin >> S;

    int ans = 1;
    for( int i = 1; i < N; i++ )
    {
        if( S[i - 1] != S[i] ) ans++;
    }
    
    cout << ans << endl;

    return 0;
}
0