import java.util.ArrayList;
import java.util.List;
public class 저주의숫자3 {
public static int solution(int n) {
int answer = 0;
List<Integer> nums_wo3 = new ArrayList<>();
for (int i = 1; i < 200; i++) {
if (i % 3 != 0) {
String tmp_num = Integer.toString(i);
if (!tmp_num.contains("3")) {
nums_wo3.add(i);
}
}
}
answer = nums_wo3.get(n-1);
return answer;
}
public static void main(String[] args) {
int result = solution(15);
System.out.println(result);
}
}
'Java > Programmers' 카테고리의 다른 글
[Lv.0]OX퀴즈 (0) | 2023.01.17 |
---|---|
[Lv.0]다항식 더하기 (0) | 2023.01.17 |
[Lv.0]특이한 정렬 (0) | 2023.01.17 |
[Lv.0]등수 매기기 (0) | 2023.01.17 |
[Lv.0]유한소수 판별하기 (0) | 2023.01.17 |
댓글