提出 #59566335


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
#define rep(i, f, t) for (int i(f); i <= t; ++i)
#define re(i, t) for (int i(1); i <= t; ++i)
#define per(i, t, f) for (int i(t); i >= f; --i)
#define pe(i, t) for (int i(t); i >= 1; --i)
#define each(i, x) for (auto &i : (x))
#define nx(i, u) for (int i(head[u]); i; i = e[i].nxt)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<double, int> pdi;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> pipii;
typedef pair<string, bool> psb;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mkp make_pair
#define ix(l, r) ((l + r) | (l != r))
#define lowbit(x) (x & -x)
#define inf (2e9)
#define INF (2e18)
#define dinf 1000000000000.0
#define eps 1e-10
#define FileIn(x) freopen(x, "r", stdin)
#define FileOut(x) freopen(x, "w", stdout)
#define FileIO(x, y) \
    FileIn(x);       \
    FileOut(y)
#define SYSP system("pause")
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define CIOO                     \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0)
#define range(x) x.begin(), x.end()
template <class T>
void read(T &x)
{
    bool sign = false;
    x = 0;
    char c = getchar();
    while (!isdigit(c))
    {
        if (c == '-')
            sign = true;
        c = getchar();
    }
    while (isdigit(c))
    {
        x = x * 10 + (c - '0');
        c = getchar();
    }
    sign ? x = -x : x;
}
template <class T, class... Args>
void read(T &x, Args &...args) { read(x), read(args...); }
template <class T>
void write(T x)
{
    if (x < 0)
        x = -x, putchar('-');
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + 48);
}
template <class T>
void write(T x, char c)
{
    write(x);
    putchar(c);
}
template <class T, class... Args>
void write(T x, char c, Args... args) { write(x, c), write(args...); }
#define ls(x) (x << 1)
#define rs(x) (x << 1 | 1)
// #define ls(x) t[x].son[0]
// #define rs(x) t[x].son[1]
// #define int long long
// #pragma GCC optimize(1)
// #pragma GCC optimize(2)
// #pragma GCC optimize(3,"Ofast")
const int N = 105;
int n, k;
char s[N];
int main()
{
    CIOO;
    cin >> n >> k;
    cin >> (s + 1);
    int now = 0, ans = 0;
    s[n + 1] = 'X';
    re(i, n + 1)
    {
        if (s[i] == 'O')
            now++;
        else
        {
            ans += now / k;
            now = 0;
        }
    }
    cout << ans << '\n';
}

提出情報

提出日時
問題 B - Strawberries
ユーザ oh_my_shy
言語 C++ 17 (Clang 16.0.6)
得点 200
コード長 2563 Byte
結果 AC
実行時間 1 ms
メモリ 3576 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 27
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3548 KiB
00_sample_01.txt AC 1 ms 3400 KiB
00_sample_02.txt AC 1 ms 3476 KiB
01_random_00.txt AC 1 ms 3452 KiB
01_random_01.txt AC 1 ms 3424 KiB
01_random_02.txt AC 1 ms 3448 KiB
01_random_03.txt AC 1 ms 3324 KiB
01_random_04.txt AC 1 ms 3400 KiB
01_random_05.txt AC 1 ms 3576 KiB
01_random_06.txt AC 1 ms 3400 KiB
01_random_07.txt AC 1 ms 3408 KiB
01_random_08.txt AC 1 ms 3452 KiB
01_random_09.txt AC 1 ms 3456 KiB
01_random_10.txt AC 1 ms 3424 KiB
01_random_11.txt AC 1 ms 3480 KiB
01_random_12.txt AC 1 ms 3576 KiB
01_random_13.txt AC 1 ms 3324 KiB
01_random_14.txt AC 1 ms 3360 KiB
01_random_15.txt AC 1 ms 3396 KiB
01_random_16.txt AC 1 ms 3576 KiB
01_random_17.txt AC 1 ms 3356 KiB
01_random_18.txt AC 1 ms 3384 KiB
01_random_19.txt AC 1 ms 3424 KiB
01_random_20.txt AC 1 ms 3396 KiB
01_random_21.txt AC 1 ms 3420 KiB
01_random_22.txt AC 1 ms 3404 KiB
01_random_23.txt AC 1 ms 3352 KiB