-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
n = int(input()) | ||
result = 0 | ||
|
||
# 한수를 판단하는 함수 | ||
def d(k): | ||
k_list = list(map(int, str(k))) | ||
if len(k_list) < 3: | ||
return True | ||
elif len(k_list) == 3: | ||
if k_list[1]-k_list[0] == k_list[2]-k_list[1]: | ||
return True | ||
else: | ||
return False | ||
else: | ||
return False | ||
|
||
|
||
for i in range(1, n+1): | ||
# if 한수면 -> result + 1 | ||
if d(i) == True: | ||
result = result + 1 | ||
|
||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def solve(a): | ||
sum = 0 | ||
for i in a: | ||
sum = sum + i | ||
return sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
def d(n): | ||
result = n | ||
for i in str(n): | ||
result = result + int(i) | ||
return result | ||
|
||
ans = [] | ||
|
||
# ans = [1, 2, 3, ...] | ||
for i in range(0, 10000): | ||
ans.append(i+1) | ||
|
||
|
||
for i in range(1, 10000): | ||
k = d(i) | ||
if k > 10000: | ||
continue | ||
else: | ||
ans[k-1] = 0 | ||
|
||
# 정답 출력 | ||
for i in ans: | ||
if i != 0: | ||
print(i) |