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
- 북리뷰
- coding
- 알고리즘
- 문제풀이
- DP
- Computer science
- 자료구조
- 개발
- 컴퓨터공학과
- 코테
- 오에스
- OS
- 정석
- bfs
- Stack
- 구현
- 오퍼레이팅시스템
- 정석학술정보관
- 스택
- 컴공
- vector
- cs
- 너비우선탐색
- 백준
- 브루트포스
- c++
- Operating System
- 컴공과
- 그래프
- 코딩
Archives
- Today
- Total
Little Jay
[C++] 백준 8958번 OX퀴즈 본문
#include <iostream>
#include <string>
using namespace std;
int main() {
int testCase;
cin >> testCase;
for (int i = 0; i < testCase; i++) {
string s;
cin >> s;
int count = 0, sum = 0;
int len = s.length();
for (int k = 0; k < len; k++) {
if (s[k] == 'O') {
count++;
}
else {
count = 0;
}
sum += count;
}
cout << sum << endl;
sum = 0;
count = 0;
}
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 10951번 A+B - 4 (0) | 2021.03.08 |
---|---|
[C++] 백준 10818번 최소, 최대 (0) | 2021.03.08 |
[C++] 백준 2657번 문자열 반복 (0) | 2021.03.07 |
[C++] 백준 2476번 주사위 (0) | 2021.03.06 |
[C++] 백준 1284번 집 주소 (0) | 2021.03.06 |
Comments