#include <stdio.h> #include <stdlib.h> int main() { int n,g,p,i,j,ok; char buff[128]; scanf("%d\n", &n); g = n/10; fgets(buff, 128, stdin); p = 0; for (i=0; i<10; ++i) { ok = 1; for (j=0; j<g; ++j) { if (buff[g*i + j] == 'N') ok = 0; } if (ok) p++; } printf("%d\n", p); 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 <stdio.h> #include <stdlib.h> int main() { int n,g,p,i,j,ok; char buff[128]; scanf("%d\n", &n); g = n/10; fgets(buff, 128, stdin); p = 0; for (i=0; i<10; ++i) { ok = 1; for (j=0; j<g; ++j) { if (buff[g*i + j] == 'N') ok = 0; } if (ok) p++; } printf("%d\n", p); return 0; } |