题解 | 记数问题

记数问题

https://www.nowcoder.com/practice/28b2d9f2bf2c48de94a1297ed90e1732

num1,num2 = input().split()
count = 0
list1 = []
for i in range(1,int(num1)+1):
    list1.append(i) 
# 把列表中的每个数字转换成字符串,然后用空字符串连接成一个整体字符串。比如12345678910    
sum = ''.join(map(str, list1))
for j in sum:
    if(j == num2):
        count+=1
print(count)

全部评论

相关推荐

点赞 评论 收藏
分享
06-20 17:42
东华大学 Java
凉风落木楚山秋:要是在2015,你这简历还可以月入十万,可惜现在是2025,已经跟不上版本了
我的简历长这样
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务