結果
| 問題 |
No.2894 Monotonic Intervals
|
| コンテスト | |
| ユーザー |
n0ma_ru
|
| 提出日時 | 2024-09-20 21:27:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 355 bytes |
| コンパイル時間 | 1,798 ms |
| コンパイル使用メモリ | 194,148 KB |
| 最終ジャッジ日時 | 2025-02-24 09:50:15 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) v.begin(),v.end()
#define dbg(x) cerr << #x << ": " << (x) << endl;
int N;
string S;
int main() {
cin >> N >> S;
S = '#' + S + '#';
int ans = 0;
for (int i = 1; i < S.size(); ++i) {
if (S[i-1] != S[i]) ++ans;
}
cout << ans-1 << '\n';
}
n0ma_ru