#include <stdio.h> char buf[101]; int main(void) { int n; scanf("%d", &n); scanf("%s", buf); int b = n / 10; int score = 0; for (int i = 0; i < n; i += b) { bool good = true; for (int j = 0; j < b; j++) { if (buf[i+j] == 'N') good = false; } if (good) score++; } printf("%d\n", score); 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 27 28 | #include <stdio.h> char buf[101]; int main(void) { int n; scanf("%d", &n); scanf("%s", buf); int b = n / 10; int score = 0; for (int i = 0; i < n; i += b) { bool good = true; for (int j = 0; j < b; j++) { if (buf[i+j] == 'N') good = false; } if (good) score++; } printf("%d\n", score); return 0; } |