python-algorithm

백준 2154 수 이어 쓰기 3

무적김두칠 2022. 10. 23. 15:14
def sol(n):
    ans = ''
    for i in range(1, n + 1):
        ans += str(i)
    return(ans.find(str(n)) + 1)

n=int(input())
print(sol(n))

https://www.acmicpc.net/problem/2154

 

2154번: 수 이어 쓰기 3

첫째 줄에 N(1 ≤ N ≤ 100,000)이 주어진다.

www.acmicpc.net

find 함수 쓰시면 쉽게 구현 가능합니다

If you use find() function , It will be easy peasy

반응형