其他分享
首页 > 其他分享> > Codeforces Round #613 (Div. 2)

Codeforces Round #613 (Div. 2)

作者:互联网

Mezo Playing Zoma

\[ Time Limit: 1 s\quad Memory Limit: 256 MB \]
可以到达的最左是 \(-L个数\),最右是 \(R个数\),所以答案就是相减一下。


view

/*************************************************************** 
    > File Name        : a.cpp
    > Author           : Jiaaaaaaaqi
    > Created Time     : 2020/1/10 22:04:03
 ***************************************************************/

#include <bits/stdc++.h>
#define  fi         first
#define  se         second
#define  pb         push_back
#define  pii        pair<int, int>
#define  dbg(x)     cout << #x << " = " << (x) << endl
#define  mes(a, b)  memset(a, b, sizeof a)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
const int    maxn = 1e5 + 10;
const ll     mod  = 1e9 + 7;
const ll     INF  = 1e18 + 100;
const int    inf  = 0x3f3f3f3f;
const double pi   = acos(-1.0);
const double eps  = 1e-8;

int n, m;
int cas, tol, T;

char s[maxn];

int main() {
    // freopen("in", "r", stdin);
    scanf("%d", &n);
    scanf("%s", s+1);
    int x = 0, y = 0;
    for(int i=1; i<=n; i++) {
        x -= s[i]=='L';
        y += s[i]=='R';
    }
    printf("%d\n", y-x+1);
    return 0;
}

标签:613,Codeforces,Zoma,Limit,Time,Div,Mezo,Playing,define
来源: https://www.cnblogs.com/Jiaaaaaaaqi/p/12184716.html