1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import java.util.Arrays; import java.util.List; public class Main { public static void main(String args[]) { d(10000); } static void d(int n) { int next; Integer[] intnum = new Integer[n+1]; for (int i = 1; i <= n; i++) { next = i; String number = Integer.toString(next); for (int j = 0; j < number.length(); j++) { next += number.charAt(j) - '0'; } if(next <= n) { intnum[i] = next; } } List<Integer> list = Arrays.asList(intnum); for (int i = 1; i < intnum.length; i++) { if(list.indexOf(i) == -1) { System.out.println(i); } } } } | cs |
'프로그래밍 > 백준' 카테고리의 다른 글
2577 숫자의 개수 (0) | 2017.10.14 |
---|---|
1152 단어의 개수 (0) | 2017.10.07 |
백준 acm 2448 - 별찍기 (11) (0) | 2017.10.06 |
백준 acm 7453 - 합이 0인 네 정수 (0) | 2017.07.30 |
백준 acm 1915 가장 큰 정사각형 (0) | 2017.07.19 |