#include <iostream>
int main()
{
int testCount = 0;
// Enter a number of tests
std::cin >> testCount;
// Enter string of 'T's and 'N's
char *testString = new char[testCount];
for (int i = 0; i < testCount; i++)
{
std::cin >> testString[i];
}
int result = 0;
for (int i = 0; i < 10; i++)
{
bool testPassed = true;
int testNum = testCount / 10;
for (int j = 0; j < testNum;j++)
{
if (testString[i * testNum + j] == 'N')
{
testPassed = false;
break;
}
}
result += testPassed ? 1 : 0;
}
std::cout << 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 31 32 33 34 35 | #include <iostream> int main() { int testCount = 0; // Enter a number of tests std::cin >> testCount; // Enter string of 'T's and 'N's char *testString = new char[testCount]; for (int i = 0; i < testCount; i++) { std::cin >> testString[i]; } int result = 0; for (int i = 0; i < 10; i++) { bool testPassed = true; int testNum = testCount / 10; for (int j = 0; j < testNum;j++) { if (testString[i * testNum + j] == 'N') { testPassed = false; break; } } result += testPassed ? 1 : 0; } std::cout << result; return 0; } |
English