[백준/BOJ] 8958. OX퀴즈 [Bronze 2]

jychan99·2021년 12월 25일
0
post-thumbnail
  1. OX퀴즈

문제출처 : https://www.acmicpc.net/problem/8958

#include <iostream>
using namespace std;

int main()
{
    int T;
    string arr;
    
    cin >> T;

    for (int i = 0; i < T; i++)
    {
        int score = 1, totalscore = 0;

        cin >> arr;
        for (int j = 0; j < arr.size(); j++)
        {
            if (arr[j] == 'O')
            {
                totalscore += score;
                score++;
            }
            else
                score = 1;
        }
        cout << totalscore<<'\n';
    }

    return 0;
}
profile
내가 지금 두려워 하고 있는 일이 바로 내가 지금 해야 할 일이다. 🐥

0개의 댓글