https://www.acmicpc.net/problem/15122
15122번: Forbidden Zero
You’re writing the positive integers in increasing order starting from one. But you’ve never learned the digit zero, and thus omit any number that contains a zero in any position. The first ten integers you write are: 1, 2, 3, 4, 5, 6, 7, 8, 9, and 11.
www.acmicpc.net
1 2 3 4 5 6 7 8 9 | def solution(s): s = str(int(s) + 1) return s.replace('0','1') if __name__ == '__main__': s = input() print(solution(s)) | cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 10448 유레카 이론 (0) | 2023.11.28 |
---|---|
백준 18141 Are They All Integers? (0) | 2023.11.28 |
백준 16283 Farm (2) | 2023.11.28 |
백준 1440 타임머신 (1) | 2023.11.28 |
백준 19564 반복 (1) | 2023.11.27 |
댓글