#include <cstdio> int n; char s[1000]; int main() { scanf("%d", &n); scanf("%s", s); bool good = true; int points = 0; int groupSize = n / 10; for (int i = 0; i < n; i++) { if (s[i] == 'N') { good = false; } if ((i + 1) % groupSize == 0) { if (good) { points++; } good = true; } } printf("%d\n", points); }
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> int n; char s[1000]; int main() { scanf("%d", &n); scanf("%s", s); bool good = true; int points = 0; int groupSize = n / 10; for (int i = 0; i < n; i++) { if (s[i] == 'N') { good = false; } if ((i + 1) % groupSize == 0) { if (good) { points++; } good = true; } } printf("%d\n", points); } |