63972023-11-27 13:34:35MCDaveBolha a számegyenesencpp17Accepted 100/1003ms4280 KiB
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n, Rcount=0, Lcount=0;
    string jumps = {};
    cin >> n >> jumps;

    for (int i = 0; i < n; i++)
    {
        if (jumps[i]=='R')
        {
            Rcount++;
        }
        else
        {
            Lcount++;
        }
    }

    if (Rcount >= Lcount)
    {
        cout << Rcount - Lcount;
    }
    else
    {
        cout << Lcount - Rcount;
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms2064 KiB
subtask215/15
3Accepted3ms2176 KiB
4Accepted3ms2388 KiB
5Accepted3ms2620 KiB
6Accepted3ms2836 KiB
subtask310/10
7Accepted3ms2916 KiB
8Accepted3ms3172 KiB
9Accepted3ms3348 KiB
10Accepted2ms3280 KiB
11Accepted3ms3532 KiB
subtask475/75
12Accepted3ms3500 KiB
13Accepted3ms3752 KiB
14Accepted3ms3724 KiB
15Accepted3ms3724 KiB
16Accepted3ms3856 KiB
17Accepted3ms3948 KiB
18Accepted3ms4192 KiB
19Accepted3ms4280 KiB
20Accepted3ms4168 KiB
21Accepted3ms4172 KiB