//Challenge: Accepted
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#define ll long long
#define maxn 200005
#define pii pair<int, ll>
#define ff first
#define ss second
#define mod 1000000007
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
string a, b;
int main() {
io
int n;
cin >> n;
cin >> a >> b;
int cur = 0, cnt = 0;
for (int i = 0;i < n;i++) {
if (b[i] - '0' != cur) {
cur ^= 1;
cnt++;
}
}
if (b[n - 1] == '0') cnt--;
cout << (cnt + 1) / 2 << "\n";
}
/*
6
000000
001110
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
5 ms |
2824 KB |
Output is correct |
8 |
Correct |
5 ms |
2824 KB |
Output is correct |
9 |
Correct |
8 ms |
2840 KB |
Output is correct |
10 |
Correct |
5 ms |
2824 KB |
Output is correct |
11 |
Correct |
7 ms |
2824 KB |
Output is correct |
12 |
Correct |
7 ms |
2824 KB |
Output is correct |
13 |
Correct |
5 ms |
2824 KB |
Output is correct |
14 |
Correct |
6 ms |
2824 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |