2175. Cow Counting

单点时限: 2.0 sec

内存限制: 256 MB

Farmer John wants to label his N (1 <= N <= 1,000,000) cows, but cows don’t like having the digit L (0 <= L <= 9) written on them, so he avoids that.

If the cows are labeled with the smallest set of N positive integers that don’t have the digit L, what is the largest number that Farmer John has to write on any cow?

输入格式

  • Line 1: Two space-separated integers: N and L.

输出格式

  • Line 1: A single integer that is the largest number that Farmer John has to write on any cow.

样例

Input
10 1
Output
22

32 人解决,51 人已尝试。

37 份提交通过,共有 109 份提交。

4.9 EMB 奖励。

创建: 17 年,7 月前.

修改: 7 年,3 月前.

最后提交: 2 年,9 月前.

来源: Elite 2007 US Open Competition

题目标签