#include<bits/stdc++.h> using namespace std; #define st first #define nd second #define pb push_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() #define sor(x) sort(all(x)) #define rev(x) reverse(all(x)) #define rsz(x) resize(x) #define BOOST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef long long ll; typedef pair<int,int>pii; typedef long double ldl; typedef pair<ll,ll>pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vii; typedef vector<pll>vll; typedef unsigned long long ul; int main() { int n; string s; cin>>n>>s; int ans=0; int k = n/10; bool ok; for(int i = 0 ; i < 10 ; i++) { ok = true; for(int j = 0 ; j < k ; j++) if(s[i*k+j]=='N') { ok = false; break; } if(ok) ans++; } cout<<ans<<'\n'; return 0; }
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> using namespace std; #define st first #define nd second #define pb push_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() #define sor(x) sort(all(x)) #define rev(x) reverse(all(x)) #define rsz(x) resize(x) #define BOOST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef long long ll; typedef pair<int,int>pii; typedef long double ldl; typedef pair<ll,ll>pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vii; typedef vector<pll>vll; typedef unsigned long long ul; int main() { int n; string s; cin>>n>>s; int ans=0; int k = n/10; bool ok; for(int i = 0 ; i < 10 ; i++) { ok = true; for(int j = 0 ; j < k ; j++) if(s[i*k+j]=='N') { ok = false; break; } if(ok) ans++; } cout<<ans<<'\n'; return 0; } |