#include<cstdio> using namespace std; int main() { int testsNum; scanf("%d\n", &testsNum); int testsInGroup = testsNum / 10; bool allPassed = true; int points = 0; for (int i = 0; i < testsNum; i++) { char passed; scanf("%c", &passed); allPassed &= (passed == 'T'); if ((i + 1) % testsInGroup == 0) { if (allPassed) { points++; } allPassed = true; } } printf("%d\n", points); }
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<cstdio> using namespace std; int main() { int testsNum; scanf("%d\n", &testsNum); int testsInGroup = testsNum / 10; bool allPassed = true; int points = 0; for (int i = 0; i < testsNum; i++) { char passed; scanf("%c", &passed); allPassed &= (passed == 'T'); if ((i + 1) % testsInGroup == 0) { if (allPassed) { points++; } allPassed = true; } } printf("%d\n", points); } |