#include <stdio.h> #include <stdbool.h> int main() { int n; scanf("%d\n", &n); int pack_size = n / 10; int testno = 0; int result = 0; bool correct = true; for (int i = 0; i < n; ++i) { char verdict; scanf("%c", &verdict); correct = correct && (verdict == 'T'); ++testno; if (testno == pack_size) { testno = 0; result += correct; correct = true; } } printf("%d\n", result); 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 | #include <stdio.h> #include <stdbool.h> int main() { int n; scanf("%d\n", &n); int pack_size = n / 10; int testno = 0; int result = 0; bool correct = true; for (int i = 0; i < n; ++i) { char verdict; scanf("%c", &verdict); correct = correct && (verdict == 'T'); ++testno; if (testno == pack_size) { testno = 0; result += correct; correct = true; } } printf("%d\n", result); return 0; } |