#include <cstdio> char results[128]; int group_size; int length; int points; int main(void) { scanf("%d %s", &length, results); group_size = length / 10; for(int s = 0; s < length; s += group_size) { bool success = true; for(int i = s; success && i < s + group_size; ++i) success = results[i] == 'T'; points += success; } 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 | #include <cstdio> char results[128]; int group_size; int length; int points; int main(void) { scanf("%d %s", &length, results); group_size = length / 10; for(int s = 0; s < length; s += group_size) { bool success = true; for(int i = s; success && i < s + group_size; ++i) success = results[i] == 'T'; points += success; } printf("%d\n", points); return 0; } |