Dev.baelanche

[백준 10551] STROJOPIS 본문

Data Structure & Algorithm/PS - JAVA

[백준 10551] STROJOPIS

baelanche 2019. 6. 10. 20:33
반응형

 

 

번역

 

누구나 풀 수 있는 난이도의 문제이다.

 

다음 영어문제는 난이도를 올려서 영어 + 해결력 을 모두 챙겨봐야겠다.

 

 

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        char c[] = sc.next().toCharArray();
        int finger[] = new int[8];
        
        for(int i=0; i<c.length; i++)
            pressKey(c[i], finger);
        
        for(int i=0; i<finger.length; i++)
            System.out.println(finger[i]);
    }
    
    public static void pressKey(char c, int f[]) {
        if(c == '1' || c == 'Q' || c == 'A' || c == 'Z')
            f[0]++;
        else if(c == '2' || c == 'W' || c == 'S' || c == 'X')
            f[1]++;
        else if(c == '3' || c == 'E' || c == 'D' || c == 'C')
            f[2]++;
        else if(c == '4' || c == '5' || c == 'R' || c == 'T' || c == 'F' || c == 'G' || c == 'V' || c == 'B')
            f[3]++;
        else if(c == '6' || c == '7' || c == 'Y' || c == 'U' || c == 'H' || c == 'J' || c == 'N' || c == 'M')
            f[4]++;
        else if(c == '8' || c == 'I' || c == 'K' || c == ',')
            f[5]++;
        else if(c == '9' || c == 'O' || c == 'L' || c == '.')
            f[6]++;
        else f[7]++;
    }
}
반응형

'Data Structure & Algorithm > PS - JAVA' 카테고리의 다른 글

[백준 1920] 수 찾기  (0) 2019.06.11
[백준 1963] 소수 경로  (0) 2019.06.10
[백준 3486] Adding Reversed Number  (0) 2019.06.10
[백준 11772] POT  (0) 2019.06.08
[백준 10451] 순열 사이클  (0) 2019.06.08
Comments