68362023-12-19 10:48:58BusMarkBolha a számegyenesencpp17Accepted 100/1003ms3504 KiB
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int N, lepes=0;
    string S;

    cin >> N;
    cin >> S;

    for(int i = 0; i <= N; i++)
    {
        if (S[i] == 'R')
            lepes += 1;
        else if (S[i] == 'L')
            lepes -= 1;
    }

    cout << abs(lepes);

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms2008 KiB
subtask215/15
3Accepted3ms2216 KiB
4Accepted3ms2428 KiB
5Accepted3ms2544 KiB
6Accepted3ms2636 KiB
subtask310/10
7Accepted3ms2752 KiB
8Accepted3ms2840 KiB
9Accepted3ms2824 KiB
10Accepted3ms2824 KiB
11Accepted3ms2820 KiB
subtask475/75
12Accepted3ms2824 KiB
13Accepted3ms2820 KiB
14Accepted3ms2828 KiB
15Accepted3ms3068 KiB
16Accepted3ms3192 KiB
17Accepted3ms3148 KiB
18Accepted3ms3404 KiB
19Accepted3ms3404 KiB
20Accepted3ms3268 KiB
21Accepted3ms3504 KiB