#include <stdio.h> int main() { char in[101]; int n,N,i,j,ret,f; scanf("%d",&N); scanf("%s",in); ret = 0; for (i = 0; i < 10; i++) { f = 1; for (j = 0; j < N/10; j++) if (in[i*N/10+j] == 'N') f = 0; if (f == 1) ret++; } printf("%d\n",ret); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> int main() { char in[101]; int n,N,i,j,ret,f; scanf("%d",&N); scanf("%s",in); ret = 0; for (i = 0; i < 10; i++) { f = 1; for (j = 0; j < N/10; j++) if (in[i*N/10+j] == 'N') f = 0; if (f == 1) ret++; } printf("%d\n",ret); return 0; } |