Hayden's Archive
[알고리즘] 백준 4673번 : 셀프 넘버 본문
알고리즘 문제 출처 : https://www.acmicpc.net/problem/4673
내가 작성한 코드
public class Main {
private static int notSelfNum (int n) {
int total = n;
int quotient = n;
while(quotient > 0) {
total += quotient % 10;
quotient /= 10;
}
return total;
}
public static void main(String[] args) {
boolean [] check= new boolean[10001];
for(int i=1; i<check.length; i++) {
if(notSelfNum(i)<10001) check[notSelfNum(i)] = true;
}
for(int i=1; i < check.length; i++) {
if(check[i]==false) System.out.println(i);
}
}
}