백준 8958번




복사가 제대로 안되네요

링크로 대신합니다.


https://www.acmicpc.net/problem/8958















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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.Scanner;
public class BAEKJOON8958 {
    
    public void Count(String s) {
        
        
        
        
    }
    public static void main(String[] args) throws Exception{
        Scanner s = new Scanner(System.in);
        
        int count = s.nextInt();
        int sum[] = new int[count];
        
        s.nextLine();
        String string[] = new String[count];
        
        //OX 정답 받기
        for(int i=0; i<count; i++){
            string[i]=s.nextLine();
        }
        //O확인하
        for(int i=0; i<count; i++){
            int co=0;
            for(int j=0; j<string[i].length(); j++){
                char test = string[i].charAt(j);
                if(test == 'O'){
                    co++;
                    sum[i] += co;
                } else
                    co=0;
                
                
            }
            System.out.println(sum[i]);
            
            
            
        }
        s.close();
    }
}
        
cs

댓글

이 블로그의 인기 게시물

Filter url 제외시키기

[Spring,Java] Validator 구현하기

[Spring] Mock framework에 대하여