30932023-02-15 16:16:01baranyimarcellTükörtojás (75 pont)cpp17Accepted 75/758ms5520 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, szml=0, i, j;
    cin>>N;
    string most, kell;
    cin>>most>>kell;
    //cout<<N<<" "<<most<<" "<<kell<<endl;
    //if (most[4]==kell[4]) cout<<"yes"<<endl;
    int m[N], k[N];
    for (i=0; i<N; i++)
    {
        if (most[i]=='S') m[i]=-1;
        else m[i]=1;
        if (kell[i]=='S') k[i]=-1;
        else k[i]=1;
    }
    for (i=N-1; i>-1; i--)
    {
        if (szml%2==0)
        {
            while (m[i]==k[i]) i--;
        }
        else
        {
            while (m[i]*-1==k[i]) i--;
        }
        if (i!=-1) szml+=1;
    }
    cout<<szml<<endl;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1680 KiB
2Accepted0/06ms3080 KiB
3Accepted5/53ms2048 KiB
4Accepted5/53ms2120 KiB
5Accepted5/53ms2464 KiB
6Accepted5/53ms2620 KiB
7Accepted5/53ms2860 KiB
8Accepted5/53ms2952 KiB
9Accepted5/53ms3196 KiB
10Accepted5/53ms3228 KiB
11Accepted5/53ms3476 KiB
12Accepted5/58ms5500 KiB
13Accepted5/58ms5480 KiB
14Accepted5/58ms5476 KiB
15Accepted5/58ms5520 KiB
16Accepted5/58ms5488 KiB
17Accepted5/58ms5376 KiB