Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- youtube iframe
- 커스텀알락
- nvmrc
- 다리놓기
- 프로토타입
- nvm
- yarn-berry
- react-firebaseui
- leetcode189
- Python
- css
- firebaseui
- 구조분해할당
- mac
- 리액트
- 백준
- 파이썬
- 자바스크립트
- 타입스크립트
- React
- iP
- Next.js
- Rest
- 기초
- 파이어베이스로그인
- Spread
- 커스텀알림
- leetcode977
- JS
- react-native
Archives
- Today
- Total
JadeCode
[백준] python 8958 OX퀴즈 본문
https://www.acmicpc.net/problem/8958
8958번: OX퀴즈
"OOXXOXXOOO"와 같은 OX퀴즈의 결과가 있다. O는 문제를 맞은 것이고, X는 문제를 틀린 것이다. 문제를 맞은 경우 그 문제의 점수는 그 문제까지 연속된 O의 개수가 된다. 예를 들어, 10번 문제의 점수
www.acmicpc.net
O가 연속으로 있으면 그 문제 점수는 연속된 O개수이다.
import sys
input = sys.stdin.readline
t = int(input())
#테스트케이스 개수만큼 반복
for _ in range(t):
arr = list(input().rstrip())
result = 0
total = 0
for i in range(0, len(arr)):
if(arr[i]=='O'):
total += 1
result += total
else:
total = 0
print(result)
'개발 > 알고리즘' 카테고리의 다른 글
[백준] python 2630 색종이 만들기 (0) | 2022.03.08 |
---|---|
[백준] python 1059 좋은 구간 (0) | 2022.02.27 |
[백준] python 2739 구구단 (0) | 2022.02.25 |
[Python] 개념정리 - for문 index, value 접근 (0) | 2022.02.17 |
[백준] python 1018 체스판 다시 칠하기 (0) | 2022.01.24 |
Comments