QOJ.ac

QOJ

시간 제한: 2 s 메모리 제한: 256 MB 총점: 100

#22531. 奶牛计数

통계

来源: 原题面的英文镜像: https://ac.nowcoder.com/acm/problem/25075

档案交叉核对: work/usaco_2007/open07/archive/analysis/analysis/OPEN07.count.htm 和 work/usaco_2007/open07/archive/testdata/count.1.in / .out.

Farmer John 想给 $N$ 头牛编号,但牛不喜欢身上写有数字 $L$,所以他避开该数字。

牛得到十进制表示不含数字 $L$ 的最小的 $N$ 个正整数。Farmer John 必须写的最大编号是多少?

输入格式

第 1 行为两个空格分隔整数 $N$、$L$,其中 $1 \le N \le 1{,}000{,}000$ 且 $0 \le L \le 9$。

输出格式

输出一个整数:Farmer John 必须写在任意牛身上的最大数。

样例

输入格式 1

10 1

输出格式 1

22

说明

不含数字 1 的前十个正整数为 2, 3, 4, 5, 6, 7, 8, 9, 20, 22.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.