python-algorithm
백준 15122 Forbidden Zero
무적김두칠
2023. 11. 28. 12:46
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 |
반응형