풀이)
시간 단축을 위해 hashmap을 활용한다.
import java.util.HashMap;
...
HashMap<String, Integer>map = new HashMap();
map.put("first", 1);
map.put("second", 2);
map.get("first");
내 코드)
import java.io.*;
import java.util.HashMap;
public class Main {
public static void main(String[]args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String st1 = bf.readLine();
String st2 = bf.readLine();
String st3 = bf.readLine();
HashMap<String, String> colors = new HashMap();
colors.put("black", "0");
colors.put("brown", "1");
colors.put("red", "2");
colors.put("orange", "3");
colors.put("yellow", "4");
colors.put("green", "5");
colors.put("blue", "6");
colors.put("violet", "7");
colors.put("grey", "8");
colors.put("white", "9");
Long result = Long.parseLong(colors.get(st1)+colors.get(st2));
result *= (long) Math.pow(10.0, Double.parseDouble(colors.get(st3)));
System.out.println(result);
}
}