56052023-08-02 17:04:42TomaSajtTükörtojás (75 pont)cpp17Accepted 75/753ms5944 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin >> n;

  string a, b;
  cin >> a >> b;

  int sol = 1;
  for (int i = 1; i < n; i++) {
    if ((a[i - 1] == b[i - 1]) != (a[i] == b[i])) {
      sol += 1;
    }
  }

  if (a[n - 1] == b[n - 1]) {
    sol -= 1;
  }

  cout << sol;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1824 KiB
2Accepted0/03ms2436 KiB
3Accepted5/53ms2256 KiB
4Accepted5/53ms2468 KiB
5Accepted5/53ms2680 KiB
6Accepted5/53ms3044 KiB
7Accepted5/52ms3088 KiB
8Accepted5/53ms3236 KiB
9Accepted5/53ms3508 KiB
10Accepted5/52ms3528 KiB
11Accepted5/53ms3532 KiB
12Accepted5/53ms4700 KiB
13Accepted5/53ms4884 KiB
14Accepted5/53ms5312 KiB
15Accepted5/53ms5520 KiB
16Accepted5/53ms5740 KiB
17Accepted5/53ms5944 KiB