반응형
https://www.acmicpc.net/problem/8958
#include <iostream>
#include <string>
#include <vector>
#define IOS_PREDEFINE() \
( \
(cin.tie(NULL)), \
(cout.tie(NULL)), \
(std::ios::sync_with_stdio(false)), \
(void) 0 \
)
using namespace std;
int main()
{
IOS_PREDEFINE();
int TestCase = 0;
cin >> TestCase;
while(TestCase--)
{
string quizRes;
cin >> quizRes;
int scoreTable[81] = {0,};
int inputSize = static_cast<int>(quizRes.length());
for(int i = 0; i < inputSize; i++)
{
if(quizRes[i] == 'O') scoreTable[i+1] = scoreTable[i] + 1;
else scoreTable[i+1] = 0;
}
int res = 0;
for(int i = 0; i <= inputSize; i++)
{
res += scoreTable[i];
}
cout << res << endl;
}
return 0;
}
'Development. > Problem solving.' 카테고리의 다른 글
[BAEKJOON] 2609 - 최대공약수와 최소공배수 (0) | 2020.08.17 |
---|---|
[BAEKJOON] 1822 - 차집합 (0) | 2020.08.17 |
[BAEKJOON] 2577 - 숫자의 개수 (0) | 2020.08.17 |
[BAEKJOON] 1065 - 한수 (0) | 2020.08.17 |
[BAEKJOON] 4673 - 셀프 넘버 (0) | 2020.08.17 |