티스토리 뷰
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | let input = Int(readLine()!)! var array = [String]() for _ in 1...input{ array.append(readLine()!) } for content in array{ var score = 0 var count = 0 for i in 0..<content.count{ let char = content[content.index(content.startIndex, offsetBy: i)].description if(char == "O"){ count += 1 } else{ count = 0 } score += count } print(score) } | cs |
'Algorithm > Baekjoon Online Judge' 카테고리의 다른 글
| 10039번 '평균 점수' (0) | 2018.02.23 |
|---|---|
| 9498번 '시험 성적' (0) | 2018.02.23 |
| 8398번 '합' (0) | 2018.02.23 |
| 7287번 '등록' (0) | 2018.02.23 |
| 5622번 '다이얼' (0) | 2018.02.23 |
댓글
