結果

問題 No.2894 Monotonic Intervals
ユーザー erbowl
提出日時 2024-09-20 21:23:04
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 3,259 ms
コンパイル使用メモリ 245,160 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-20 21:23:11
合計ジャッジ時間 3,753 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;

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

signed main(){
    ll n;
    std::cin >> n;
    string s;
    std::cin >> s;
    ll ans = 1;
    for (int i = 1; i < n; i++) {
        if(s[i-1]!=s[i])ans++;
    }
    std::cout << ans << std::endl;
    
};
0