백준 - 8958 OX퀴즈
문제
8958 OX퀴즈
답
kotlin code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.*
fun main() {
q8958()
}
fun q8958() = with(Scanner(System.`in`)) {
val count = nextInt()
val questions = Array(count){next()}
val result = Array(count){0}
for(i in 0 until count) {
var point = 0;
for(j in questions[i].toCharArray()) when(j) {
'X' -> point = 0
'O' -> result[i] += ++point
}
println(result[i])
}
}
This post is licensed under CC BY 4.0 by the author.