BOJ - 17389 - 보너스 점수

Updated:

import sys

def solution():
    N = int(input())
    S = str(input())

    score = 0
    bonus = 0
    for i in range(len(S)):
        if S[i] == 'O':
            score += (i + 1)
            score += bonus
            bonus += 1
        else:
            bonus = 0

    print(score)

solution()

https://www.acmicpc.net/problem/17389

Categories:

Updated:

Leave a comment