#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
int x, d, res, i, j, ok;
char t[105];
int main() {
scanf("%d", &x);
scanf("%s", t);
d = x / 10;
res = 0;
for (i=0;i<10;i++) {
ok = 1;
for (j=i*d;j<(i+1)*d;j++) if (t[j] == 'N') ok = 0;
if (ok) res++;
}
printf("%d\n", res);
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 | #include <bits/stdc++.h> using namespace std; typedef vector<int> VI; typedef pair <int,int> ii; typedef long long LL; #define pb push_back const int INF = 2147483647; int x, d, res, i, j, ok; char t[105]; int main() { scanf("%d", &x); scanf("%s", t); d = x / 10; res = 0; for (i=0;i<10;i++) { ok = 1; for (j=i*d;j<(i+1)*d;j++) if (t[j] == 'N') ok = 0; if (ok) res++; } printf("%d\n", res); return 0; } |
English