| #include <iostream> #include <string> | |
| using namespace std; | |
| int score[80]; | |
| int main(){ | |
| int n; | |
| cin >> n; | |
| while(n-->0){ | |
| string s; | |
| cin >> s; | |
| int ans=0; | |
| if(s[0]=='O') score[0]=1; | |
| else score[0]=0; | |
| ans=score[0]; | |
| for(int i=1; i<s.size(); i++){ | |
| if(s[i]=='O')score[i]=score[i-1]+1; | |
| else score[i]=0; | |
| ans+=score[i]; | |
| } | |
| cout << ans <<endl; | |
| } | |
| } |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
| 180418_15683_감시 (0) | 2018.04.18 |
|---|---|
| 180417_15685_드래곤커브 (0) | 2018.04.17 |
| 180414_2098_외판원 순회 (0) | 2018.04.14 |
| 180412_15552_빠른 A+B (0) | 2018.04.12 |
| 180411_세가지 합 구하기 (0) | 2018.04.11 |