#include <cstdio> int main() { int n; scanf("%d\n", &n); char buf[100]; int i = 0; while (i < n) { int c = getc(stdin); if (c == 'T' || c == 'N') { buf[i] = (char)c; i++; } } int points = 0; for (int group = 0; group < 10; group++) { bool passed = true; for (int i = 0; i < n / 10; i++) { if (buf[group * (n / 10) + i] == 'N') { passed = false; break; } } if (passed) { points++; } } printf("%d\n", points); 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 | #include <cstdio> int main() { int n; scanf("%d\n", &n); char buf[100]; int i = 0; while (i < n) { int c = getc(stdin); if (c == 'T' || c == 'N') { buf[i] = (char)c; i++; } } int points = 0; for (int group = 0; group < 10; group++) { bool passed = true; for (int i = 0; i < n / 10; i++) { if (buf[group * (n / 10) + i] == 'N') { passed = false; break; } } if (passed) { points++; } } printf("%d\n", points); return 0; } |