#include <bits/stdc++.h> #define IN(x) int x; scanf("%d", &x) #define OUT(x) printf("%d\n", x) #define FRN(ii, ll, uu) for(int ii = (ll); ii < uu; ++ii) #define FOR(ii, nn) FRN(ii, 0, nn) #define LI long long #define LIN(x) LI x; scanf("%lld", &x) #define LOUT(x) printf("%lld\n", x) #define GETS(s) scanf(" %s", s) // 2**62-1, won't overflow if doubled #define LINF 4611686018427387903LL #define BYTE unsigned char /// END OF BOILERPLATE ;) using namespace std; int main() { int n; string s; cin >> n >> s; int T = n / 10; int sp = 0; // cout << s << " " << T << endl; for (int np=0; np < 10; ++np) { int pt = 1; for (int nt=0; nt < T; ++nt) { int pos = np*T+nt; // cout << pos << s[pos] << endl; if (s[pos] == 'N') { pt = 0; break; } } sp += pt; // cout << endl; } cout << sp << endl; 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #include <bits/stdc++.h> #define IN(x) int x; scanf("%d", &x) #define OUT(x) printf("%d\n", x) #define FRN(ii, ll, uu) for(int ii = (ll); ii < uu; ++ii) #define FOR(ii, nn) FRN(ii, 0, nn) #define LI long long #define LIN(x) LI x; scanf("%lld", &x) #define LOUT(x) printf("%lld\n", x) #define GETS(s) scanf(" %s", s) // 2**62-1, won't overflow if doubled #define LINF 4611686018427387903LL #define BYTE unsigned char /// END OF BOILERPLATE ;) using namespace std; int main() { int n; string s; cin >> n >> s; int T = n / 10; int sp = 0; // cout << s << " " << T << endl; for (int np=0; np < 10; ++np) { int pt = 1; for (int nt=0; nt < T; ++nt) { int pos = np*T+nt; // cout << pos << s[pos] << endl; if (s[pos] == 'N') { pt = 0; break; } } sp += pt; // cout << endl; } cout << sp << endl; return 0; } |