반응형
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 | #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { int n; scanf("%d", &n); while(n--) { char s[81]; scanf("%s", s); int score = 0; int count = 1; for(int i = 0; s[i] != NULL; i++) { if(s[i] == 'O') score += count; if(s[i] == s[i + 1]) { count++; } else count = 1; } printf("%d\n", score); } return 0; } | cs |
'알고리즘 > 백준' 카테고리의 다른 글
10809번 알파벳 찾기 (0) | 2018.10.09 |
---|---|
10039번 평균 점수 (0) | 2018.10.09 |
4344번 평균은 넘겠지 (0) | 2018.10.09 |
2920번 음계 (0) | 2018.10.09 |
2908번 상수 (0) | 2018.10.09 |