#include <bits/stdc++.h> using namespace std; int n; char c[105]; int w = 0; int main() { scanf("%d\n", &n); scanf("%s", c); bool tru = true; for(int i = 0; i < n; ++i) { if(c[i] == 'N') tru = false; if((i+1)%(n/10) == 0) { if(tru) w++; tru = true; } } printf("%d\n", w); }
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; int n; char c[105]; int w = 0; int main() { scanf("%d\n", &n); scanf("%s", c); bool tru = true; for(int i = 0; i < n; ++i) { if(c[i] == 'N') tru = false; if((i+1)%(n/10) == 0) { if(tru) w++; tru = true; } } printf("%d\n", w); } |