QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#5581. Champernowne 计数

Statistics

第 $n$ 个 Champernowne 数是通过将前 $n$ 个正整数依次连接在一起得到的。例如,第 10 个 Champernowne 数是 “12345678910”。

给定两个正整数 $n$ 和 $k$,计算前 $n$ 个 Champernowne 数中有多少个能被 $k$ 整除。

输入格式

输入仅一行,包含两个整数 $n$ ($1 \le n \le 10^5$) 和 $k$ ($1 \le k \le 10^9$)。

输出格式

输出一个整数,表示前 $n$ 个 Champernowne 数中能被 $k$ 整除的个数。

样例

样例输入 1

4 2

样例输出 1

2

样例输入 2

100 7

样例输出 2

14

样例输入 3

314 159

样例输出 3

4

样例输入 4

100000 999809848

样例输出 4

1

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.