내 풀이(미완성)
T = int(input())
score = 0
for i in range(T):
case = input()
for j in range(len(case)):
while case[j] == "X":
for r in range(case.count("O")):
score += r
정석 풀이
n = int(input())
for _ in range(n):
ox_list = list(input()) #리스트로 입력받는다.
score = 0
sum_score = 0 # 새로운 ox리스트를 입력 받으면 점수 합계를 리셋한다.
for ox in ox_list:
if ox == 'O':
score += 1 # 'O'가 연속되면 점수가 1점씩 커진다.
sum_score += score
else:
score = 0
print(sum_score)
'백준' 카테고리의 다른 글
백준 10810번: 공 넣기 (0) | 2023.07.18 |
---|---|
백준 10818번: 최소, 최대💦 (0) | 2023.07.18 |
백준 9506번: 약수들의 합💦 (0) | 2023.07.17 |
백준 2480번: 주사위 세개💦 (0) | 2023.07.14 |
백준 2525번: 오븐시계💦 (0) | 2023.07.14 |