제출 #1266474

#제출 시각아이디문제언어결과실행 시간메모리
1266474canhnam357Aron (COCI17_aron)C++20
50 / 50
1 ms328 KiB
// source problem : 
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define int long long
#define lb lower_bound
#define ub upper_bound
#define MASK(i) (1LL << (i))
const int inf = 1e18;
void ckmax(int& f, int s)
{
    f = (f > s ? f : s);
}
void ckmin(int& f, int s)
{
    f = (f < s ? f : s);
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int ans = 2;
    int n;
    cin >> n;
    char c, l;
    for (int i = 0; i < n; i++) {
        cin >> c;
        if (i && c != l) ans++;
        l = c;
    }   
    cout << ans;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...