-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBJ4673.py
More file actions
67 lines (59 loc) · 1.43 KB
/
BJ4673.py
File metadata and controls
67 lines (59 loc) · 1.43 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# notSelfNumber = []
# # 각 자릿수의 숫자를 1, 10, 100, 1000의 자리를 구분하여서 구한 후
# for i in range(1, 10000):
# if i >= 1000:
# d = i % 10
# c = (i // 10) % 10
# b = (i // 100) % 10
# a = i // 1000
# elif i >= 100:
# d = i % 10
# c = (i // 10) % 10
# b = i // 100
# a = 0
# elif i >= 10:
# d = i % 10
# c = i // 10
# b = 0
# a = 0
# elif i > 0:
# d = i
# c = 0
# b = 0
# a = 0
# # 셀프넘버가 아닌 숫자들을 구해서 리스트를 만들어준다
# num = i + a + b + c + d
# notSelfNumber.append(num)
# # 셀프넘버가 아닌 숫자들의 리스트에 들어있지 않으면 셀프넘버이므로 리스트에 있지 않으면 출력한다
# for i in range(1, 10000):
# if i in notSelfNumber:
# continue
# else:
# print(i)
## 2트
arr = []
for i in range(1, 10001):
if i >= 1000:
d = i % 10
c = (i // 10) % 10
b = (i // 100) % 10
a = i // 1000
elif i >= 100:
d = i % 10
c = (i // 10) % 10
b = i // 100
a = 0
elif i >= 10:
d = i % 10
c = i // 10
b = 0
a = 0
elif i > 0:
d = i
c = 0
b = 0
a = 0
arr.append(a + b + c + d + i)
for i in range(1, 10001):
if i not in arr:
print(i)