6886 | 2023-12-19 14:11:27 | barmi3 | Bolha a számegyenesen | cpp17 | Accepted 100/100 | 3ms | 3952 KiB |
#include <iostream>
using namespace std;
int main()
{
int N,R=0,L=0;
cin>>N;
char S[N];
for(int i=0;i<N;i++)
{
cin>>S[i];
}
for(int i=0;i<N;i++)
{
if(S[i]=='R')
R++;
if(S[i]=='L')
L++;
}
if(R>=L)
cout<<R-L<<endl;
if(L>R)
cout<<L-R<<endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1748 KiB | ||||
2 | Accepted | 3ms | 1916 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 3ms | 1996 KiB | ||||
4 | Accepted | 3ms | 2236 KiB | ||||
5 | Accepted | 3ms | 2368 KiB | ||||
6 | Accepted | 3ms | 2592 KiB | ||||
subtask3 | 10/10 | ||||||
7 | Accepted | 3ms | 2632 KiB | ||||
8 | Accepted | 3ms | 2632 KiB | ||||
9 | Accepted | 3ms | 2780 KiB | ||||
10 | Accepted | 3ms | 2940 KiB | ||||
11 | Accepted | 3ms | 3076 KiB | ||||
subtask4 | 75/75 | ||||||
12 | Accepted | 3ms | 3292 KiB | ||||
13 | Accepted | 3ms | 3300 KiB | ||||
14 | Accepted | 3ms | 3264 KiB | ||||
15 | Accepted | 3ms | 3400 KiB | ||||
16 | Accepted | 3ms | 3480 KiB | ||||
17 | Accepted | 3ms | 3480 KiB | ||||
18 | Accepted | 3ms | 3604 KiB | ||||
19 | Accepted | 3ms | 3720 KiB | ||||
20 | Accepted | 3ms | 3952 KiB | ||||
21 | Accepted | 3ms | 3900 KiB |