QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22531. 乳牛計數

Statistics

來源: 原題面的英文鏡像: 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.