結果

問題 No.2894 Monotonic Intervals
ユーザー hiro71687k
提出日時 2024-09-21 03:00:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 4,261 ms
コンパイル使用メモリ 256,484 KB
最終ジャッジ日時 2025-02-24 10:55:40
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=10000000000000000;
int main(){
    map<ll,ll>memo;
    memo[0]=1;
    ll now=0;
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll ans=1;
    for (ll i = 1; i < n; i++)
    {
        if (s[i]!=s[i-1])
        {
            ans++;
        }
        
    }
    cout << ans << endl;
}
0