#include <cstdio> const int maxn = 100; char str[maxn+1]; int main() { int n; scanf("%d", &n); scanf("%s", str); int n_per_point = n/10; int points=0; for(int i=0;i<n;i+=n_per_point) { bool is_correct=true; for(int j=i;j<i+n_per_point;j++) if(str[j]=='N') { is_correct=false; break; } if(is_correct) points++; } printf("%d\n", points); 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 | #include <cstdio> const int maxn = 100; char str[maxn+1]; int main() { int n; scanf("%d", &n); scanf("%s", str); int n_per_point = n/10; int points=0; for(int i=0;i<n;i+=n_per_point) { bool is_correct=true; for(int j=i;j<i+n_per_point;j++) if(str[j]=='N') { is_correct=false; break; } if(is_correct) points++; } printf("%d\n", points); return 0; } |