#include <bits/stdc++.h> #define pil pair<int, ll> #define vil vector<pil> #define vvil vector<vil> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define vii vector<pii> #define vvi vector<vi> #define vvii vector<pii> #define vb vector<bool> #define vvb vector<vb> #define vll vector<pll> #define vl vector<ll> #define vvl vector<vl> #define endl '\n' #define turbo ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define pb push_back #define ll long long #define f first #define s second #define mide (lo+hi)/2 #define mid (l+r)/2 #define lowbit(x) x&(-x) using namespace std; string str; int n; bool git(int a, int b) { for(;a<b;a++) if(str[a]=='N') return false; return true; } int main() { turbo cin >> n >> str; n/=10; int res = 0; for(int i = 0; i < str.size(); i+=n) if(git(i, i+n)) res++; cout << res; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include <bits/stdc++.h> #define pil pair<int, ll> #define vil vector<pil> #define vvil vector<vil> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define vii vector<pii> #define vvi vector<vi> #define vvii vector<pii> #define vb vector<bool> #define vvb vector<vb> #define vll vector<pll> #define vl vector<ll> #define vvl vector<vl> #define endl '\n' #define turbo ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define pb push_back #define ll long long #define f first #define s second #define mide (lo+hi)/2 #define mid (l+r)/2 #define lowbit(x) x&(-x) using namespace std; string str; int n; bool git(int a, int b) { for(;a<b;a++) if(str[a]=='N') return false; return true; } int main() { turbo cin >> n >> str; n/=10; int res = 0; for(int i = 0; i < str.size(); i+=n) if(git(i, i+n)) res++; cout << res; } |