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

30 人解决,49 人已尝试。

33 份提交通过,共有 87 份提交。

4.9 EMB 奖励。

创建: 14 年,7 月前.

修改: 4 年,3 月前.

最后提交: 1 月,1 周前.

来源: Elite 2007 US Open Competition

题目标签