Official

B - 花壇の水やり / Watering the Flower Bed Editorial by MtSaka Editorial for printing


\(K=1\) とすることですべての区画に水がまかれます。したがって、答えは \(S\) に含まれる o の数になります。

実装例(C++)

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    cout << count(s.begin(), s.end(), 'o') << endl;
}

posted:
last update: