[hdu 3652] B-number

本文介绍了B-number的概念,即包含子串'13'且能被13整除的非负整数。文章提出了一个编程挑战,要求计算从1到给定整数n之间有多少个B-number。对于输入范围1到1000000000的正整数n,给出了样例输出。解决方案包括使用记忆化深度优先搜索和数位动态规划的方法来求解。
摘要由CSDN通过智能技术生成

Problem Description
A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string “13” and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but 143 and 2639 are not. Your task is to calculate how many wqb-numbers from 1 to n for a given integer n.

Input
Process till EOF. In each line, there is one positive integer n(1 <= n <= 1000000000).

Output
Print each answer in a single line.

Sample Input

13
100
200
1000

Sample Output

1
1
2
2

题意:找出1~n范围内含有13并且能被13整除的数字的个数

思路:使用记忆化深搜来记录状态,配合数位DP来解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

真·skysys

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值