题解 | 记数问题
记数问题
https://www.nowcoder.com/practice/28b2d9f2bf2c48de94a1297ed90e1732
n,x=map(int,input().split())
count=0
target=str(x)
for i in range(1,n+1):
count+=str(i).count(target)
print(count)
主要要注意不能用if来看某个数字中是否含有x,然后利用count+=1,这样算的话,如果某个字符含有多个x,也只记录了一次。

