80682024-01-12 11:52:37tarjanmiciTükörtojás (75 pont)cpp17Accepted 75/758ms5708 KiB
#include <iostream>
#include<vector>
using namespace std;

int main() {
	int n, sz;
	cin >> n;
	string most, lesz;
	cin >> most >> lesz;
	vector<int> joe(n);
	vector<int> rossze;
	for (int i = 0; i < n; i++) {
		if (most[i] == lesz[i]) {
			joe[i] = 1;
		}
	}
	int lu = 2;
	for (int i = 0; i < n; i++) {
		if (joe[i] != lu) {
			lu = joe[i];
			rossze.push_back(joe[i]);
		}
	}
	if (rossze[rossze.size() - 1] == 1) {
		rossze.pop_back();
	}
	sz = rossze.size();
	cout << sz;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1684 KiB
2Accepted0/06ms2980 KiB
3Accepted5/53ms2060 KiB
4Accepted5/52ms2140 KiB
5Accepted5/52ms2260 KiB
6Accepted5/53ms2256 KiB
7Accepted5/53ms2144 KiB
8Accepted5/53ms2412 KiB
9Accepted5/53ms2404 KiB
10Accepted5/53ms2552 KiB
11Accepted5/53ms2892 KiB
12Accepted5/58ms4884 KiB
13Accepted5/58ms4900 KiB
14Accepted5/58ms5092 KiB
15Accepted5/58ms5184 KiB
16Accepted5/58ms5528 KiB
17Accepted5/58ms5708 KiB