https://www.acmicpc.net/problem/14912
1
2
3
4
5
6
7
8
9
10
|
def sol(start_num, target):
target = str(target)
answer = 0
for i in range(1,start_num+1):
answer += str(i).count(target)
return answer
if __name__ == '__main__':
start_num, target = map(int, input().split())
print(sol(start_num, target))
|
cs |
count 함수와 반복문을 이용하시면 됩니다
Use count function and loop
반응형
'python-algorithm' 카테고리의 다른 글
백준 19947 투자의 귀재 배주형 (0) | 2022.12.12 |
---|---|
백준 13333 Q-인덱스 (0) | 2022.12.12 |
백준 15719 중복된 숫자 (0) | 2022.12.08 |
백준 25773 Number Maximization (0) | 2022.12.08 |
백준 26040 특정 대문자를 소문자로 바꾸기 (0) | 2022.12.07 |
댓글