본문 바로가기

Algorithm/[BOJ] - JAVA

[백준] 8958 : OX퀴즈 JAVA 풀이

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int testcase = Integer.parseInt(br.readLine());
String str;
for(int i=0;i<testcase;i++){
int score = 0;
int sum = 0;
str = br.readLine();
for(int j=0;j<str.length();j++){
if(str.charAt(j)=='O')
{
score++;
sum += score;
}
else if(str.charAt(j)=='X'){
score = 0;
}
}
System.out.println(sum);
}
}
}

오늘 목표치 끝!!

아무런 도움없이 혼자서 처음부터 끝까지 구현한 건 두 문제? 정도인 것 같지만 뿌듯하다