67952023-12-19 10:11:39TheViktorBolha a számegyenesencpp17Accepted 100/1003ms4448 KiB
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int n, dbr= 0, dbl=0, db=1;
    char l;
    cin >> n;
    dbr = 0;
    dbl = 0;
    for (int i = 0; i < n; i++){
        cin >> l;
        if (l == 'R')
            dbr++;
        if (l == 'L')
            dbl--;


    }
    int ossz = abs(dbl+dbr);
    if (dbr == dbl)
            cout << "0";
            else
    cout << ossz;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1748 KiB
2Accepted3ms1912 KiB
subtask215/15
3Accepted3ms2152 KiB
4Accepted3ms2364 KiB
5Accepted3ms2456 KiB
6Accepted3ms2548 KiB
subtask310/10
7Accepted3ms2760 KiB
8Accepted3ms3004 KiB
9Accepted3ms3180 KiB
10Accepted3ms3304 KiB
11Accepted3ms3268 KiB
subtask475/75
12Accepted3ms3396 KiB
13Accepted3ms3608 KiB
14Accepted3ms3852 KiB
15Accepted3ms4064 KiB
16Accepted3ms4116 KiB
17Accepted3ms4244 KiB
18Accepted3ms4324 KiB
19Accepted3ms4448 KiB
20Accepted3ms4328 KiB
21Accepted3ms4336 KiB