간단한 369 게임
N = int(input())
result = []
for n in range(1, N+1):
numStr = str(n)
count = 0
if numStr.find("3") > -1:
count += numStr.count("3")
if numStr.find("6") > -1:
count += numStr.count("6")
if numStr.find("9") > -1:
count += numStr.count("9")
if count == 0:
result.append(str(n))
else:
result.append("-" * count)
print(' '.join(result))
728x90
'Algorithm&CodingTest > SW Expert Acardemy' 카테고리의 다른 글
[SWEA][D2] 2001 파리 퇴치 Python (0) | 2024.01.16 |
---|---|
[SWEA][D1] [2058] 자릿수 더하기 - Python (1) | 2023.05.16 |
[SWEA][D1] [2043] 서랍의 비밀번호 - Python (0) | 2023.05.16 |
[SWEA][D1] [2025] N줄 덧셈 - Python (0) | 2023.05.16 |
[SWEA] [2046] 스탬프 찍기 - python (0) | 2023.05.16 |