#include<cstdio> #include<algorithm> #include<iostream> using namespace std; int main(void){ int n; scanf("%d",&n); string s; cin >> s; int l = n/10; int ans = 0; for(int i = 1; i <= 10;i++){ bool good = true; for(int j = (i-1)*l; j < i*l; j++){ if(s[j] == 'N') good = false; } if(good) ans++; } printf("%d",ans); 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 | #include<cstdio> #include<algorithm> #include<iostream> using namespace std; int main(void){ int n; scanf("%d",&n); string s; cin >> s; int l = n/10; int ans = 0; for(int i = 1; i <= 10;i++){ bool good = true; for(int j = (i-1)*l; j < i*l; j++){ if(s[j] == 'N') good = false; } if(good) ans++; } printf("%d",ans); return 0; } |