ylab 2022. 4. 16. 20:50

https://mostar39.tistory.com/88

 

[백준 문제풀이] 얼렁뚱땅 14912번 숫자빈도수 풀이

시간 : 208 ms import sys n, m = map(int,sys.stdin.readline().split()) count = 0 for i in range(1,n+1) : if str(m) in str(i) : for j in range(len(str(i))) : if str(i)[j] == str(m) : count += 1 print..

mostar39.tistory.com

#예전에 풀었던 이코테 문제가 생각나는 문제 
#그때와는 다르게 모든 자릿수를 카운팅 해야됨
#모든 자릿수 잘라서 리스트에 넣은다음 대조?

n,m=list(map(int, input().split()))

count=0
for i in range(1,n+1):
    if str(m) in str(i):
        for j in range(len(str(i))):
            if str(m) == str(i)[j]:
                count+=1


print(count)