티스토리 뷰

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
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2026/03   »
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
글 보관함