-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_4673.java
More file actions
36 lines (30 loc) ยท 767 Bytes
/
_4673.java
File metadata and controls
36 lines (30 loc) ยท 767 Bytes
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
30
31
32
33
34
35
36
package backjoon;
// https://www.acmicpc.net/problem/4673
// ์
ํ ๋๋ฒ
public class _4673 {
//sol memory 12228 runtime 132
static int d(int n){
int sum = n;
while(n != 0){
// ์ฒซ ์งธ ์๋ฆฌ์
sum += n % 10;
// 10์ ๋๋์ด ์ฒซ ์งธ ์๋ฆฌ๋ฅผ ์์ค๋ค
n /= 10;
}
return sum;
}
public static void main(String[] args) {
boolean[] isNotSelfNumber = new boolean[10001]; // 1๋ถํฐ 10000์ด๋ฏ๋ก
for (int i = 1; i < 10001; i++){
int n = d(i);
if(n < 10001){ // 10000 ์ด ๋๋ ์๋ ํ์๊ฐ ์์
isNotSelfNumber[n] = true;
}
}
for (int i = 1; i < isNotSelfNumber.length; ++i) {
if (!isNotSelfNumber[i]) {
System.out.println(i);
}
}
}
}