#include <bits/stdc++.h>
using namespace std;
string s;
bool if_good = true;
int n,group_size,value;
int main()
{
cin>>n;
cin>>s;
group_size = n / 10;
for(int i = 0;i < s.size();++i)
{
if(s[i] == 'N')if_good = false;
if(!((i + 1) % group_size))
{
if(if_good)++value;
if_good = true;
}
}
cout<<value<<endl;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <bits/stdc++.h> using namespace std; string s; bool if_good = true; int n,group_size,value; int main() { cin>>n; cin>>s; group_size = n / 10; for(int i = 0;i < s.size();++i) { if(s[i] == 'N')if_good = false; if(!((i + 1) % group_size)) { if(if_good)++value; if_good = true; } } cout<<value<<endl; } |
English