Algorithm

백준 5622번: 다이얼

qlyh8 2018. 10. 20. 02:58

문제출처: https://www.acmicpc.net/problem/5622




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String input = reader.readLine();
        // 2:ABC, 3:DEF, 4:GHI, 5:JKL, 6:MNO, 7:PQRS, 8:TUV, 9:WXYZ (1초씩 더 걸림)
        int[] arr = {333444555666777888899910101010};
        int result = 0;
        
        for(int i=; i<input.length() ; i++)
            result += arr[input.charAt(i)-'A'];
        
        System.out.println(result);
    }
}
cs