반응형
/*
* Author : Jeonghun Cho
* Date : December 3, 2019
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int[] size = new int[Integer.parseInt(br.readLine())];
String[] str = new String[size.length];
int count = 0;
int sum = 0;
char ch;
for(int i=0; i<size.length; i++) {
str[i] = br.readLine();
}
for(int i=0; i<size.length; i++) {
for(int j=0; j<str[i].length(); j++) {
ch = str[i].charAt(j);
if(ch == 'O') {
sum = sum + (++count);
}else {
count = 0; //
}
}
sum = 0;
count = 0;
}
}
}
Colored by Color Scripter
|
반응형
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 11654 아스키 코드 (Java) (0) | 2019.12.04 |
---|---|
[백준] 15596 정수 N개의 합 (Java) (0) | 2019.12.04 |
[백준] 1546 평균 (Java) (0) | 2019.12.03 |
[백준] 2577 숫자의 개수 (Java) (0) | 2019.12.03 |
[백준] 2562 최댓값 (Java) (0) | 2019.12.03 |