코드 돌아가는데 엄청난 시간이 걸렸다 -_ㅠ
public class Main {
enum Color { black, brown, red, orange, yellow, green, blue, violet, grey, white; }
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int res = 0;
for(int i=1; i<=3; i++) {
String s = sc.nextLine();
int index = Color.valueOf(s).ordinal();
if(i == 3)
System.out.println((long) (res * (Math.pow(10, index))));
else
res = Integer.parseInt(Integer.toString(res) + Integer.toString(index));
}
}
}
'알고리즘 > Boj' 카테고리의 다른 글
[JAVA] 백준 1152 - 단어의 개수 (0) | 2020.11.27 |
---|---|
[JAVA] 백준 1100 - 하얀 칸 (0) | 2020.11.27 |
[JAVA] 백준 1075 - 나누기 (0) | 2020.11.23 |
[C++] 백준 10026 - 적록색약 (0) | 2019.10.12 |
[C++] 백준 1012 - 유기농 배추 (0) | 2019.09.22 |