#include <cstdio> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define INT(x) int x; scanf("%d", &x) #define STR(n,x) char x[n]; scanf("%s", x) bool ok[10]; int main() { INT(n); STR(101, a); REP(i,10) ok[i] = 1; int t = n / 10; REP(i,n) if (a[i] == 'N') ok[i / t] = 0; int r = 0; REP(i,10) r += ok[i]; printf("%d\n", r); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <cstdio> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define INT(x) int x; scanf("%d", &x) #define STR(n,x) char x[n]; scanf("%s", x) bool ok[10]; int main() { INT(n); STR(101, a); REP(i,10) ok[i] = 1; int t = n / 10; REP(i,n) if (a[i] == 'N') ok[i / t] = 0; int r = 0; REP(i,10) r += ok[i]; printf("%d\n", r); } |