6397 | 2023-11-27 13:34:35 | MCDave | Bolha a számegyenesen | cpp17 | Accepted 100/100 | 3ms | 4280 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;
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2064 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 3ms | 2176 KiB | ||||
4 | Accepted | 3ms | 2388 KiB | ||||
5 | Accepted | 3ms | 2620 KiB | ||||
6 | Accepted | 3ms | 2836 KiB | ||||
subtask3 | 10/10 | ||||||
7 | Accepted | 3ms | 2916 KiB | ||||
8 | Accepted | 3ms | 3172 KiB | ||||
9 | Accepted | 3ms | 3348 KiB | ||||
10 | Accepted | 2ms | 3280 KiB | ||||
11 | Accepted | 3ms | 3532 KiB | ||||
subtask4 | 75/75 | ||||||
12 | Accepted | 3ms | 3500 KiB | ||||
13 | Accepted | 3ms | 3752 KiB | ||||
14 | Accepted | 3ms | 3724 KiB | ||||
15 | Accepted | 3ms | 3724 KiB | ||||
16 | Accepted | 3ms | 3856 KiB | ||||
17 | Accepted | 3ms | 3948 KiB | ||||
18 | Accepted | 3ms | 4192 KiB | ||||
19 | Accepted | 3ms | 4280 KiB | ||||
20 | Accepted | 3ms | 4168 KiB | ||||
21 | Accepted | 3ms | 4172 KiB |