#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i,x,n) for(ll i=x;i<n;i++) #define loopr(i,x,n) for(ll i = n-1;i>=x;i--) #define all(v) v.begin(),v.end() #define print(v) for(auto xx : v){cout<<xx<<" ";}cout<<endl; #define debug if(DEBUG) cout #define ff first #define ss second const ll Mod = 1E9+7, L = 1E18, N = 1E6+9; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, ans = 0; cin >> n; string s; cin >> s; for(int i = 0;i<n;i+=(n/10)){ bool ok = true; for(int j = i;j<i+n/10;j++){ if (s[j] == 'N') ok = false; } ans += ok; } cout << ans << '\n'; }
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 | #include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i,x,n) for(ll i=x;i<n;i++) #define loopr(i,x,n) for(ll i = n-1;i>=x;i--) #define all(v) v.begin(),v.end() #define print(v) for(auto xx : v){cout<<xx<<" ";}cout<<endl; #define debug if(DEBUG) cout #define ff first #define ss second const ll Mod = 1E9+7, L = 1E18, N = 1E6+9; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, ans = 0; cin >> n; string s; cin >> s; for(int i = 0;i<n;i+=(n/10)){ bool ok = true; for(int j = i;j<i+n/10;j++){ if (s[j] == 'N') ok = false; } ans += ok; } cout << ans << '\n'; } |