답안 #525680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
525680 2022-02-12T14:04:50 Z BackNoob Aron (COCI17_aron) C++14
10 / 50
1 ms 316 KB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define MASK(i) (1LL << (i))
#define ull unsigned long long
#define ld long double
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define BIT(x , i) ((x >> (i)) & 1) 
#define TASK "task"
#define sz(s) (int) (s).size()

using namespace std;
const int mxN = 3e5 + 227;
const int inf = 1e9 + 277;
const int mod = 1e9 + 7;
const ll infll = 1e18 + 7;
const int base = 307;
const int LOG = 20;
 
template <typename T1, typename T2> bool minimize(T1 &a, T2 b) {
	if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b) {
	if (a < b) {a = b; return true;} return false;
}

int n;

void solve()
{	
	cin >> n;
	int cur = 0;
	char pre = '?';
	for(int i = 1 ; i <= n ; i++) {
		char c;
		cin >> c;
		if(c != pre) ++cur;
	}

	cout << cur + 1 << endl;
}
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen(TASK".in" , "r" , stdin);
    //freopen(TASK".out" , "w" , stdout);
    
    int tc = 1;
    //cin >> tc;
    while(tc--) {
    	solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Incorrect 0 ms 312 KB Output isn't correct
8 Incorrect 1 ms 316 KB Output isn't correct
9 Incorrect 1 ms 204 KB Output isn't correct
10 Incorrect 0 ms 204 KB Output isn't correct