QOJ.ac

QOJ

حد الوقت: 2.0 s حد الذاكرة: 2048 MB مجموع النقاط: 100

#10587. Champernowne 子序列

الإحصائيات

第 $k$ 个 Champernowne 数是通过写下前 $k$ 个正整数并将它们连接在一起得到的。 例如,第 $10$ 个 Champernowne 数是 12345678910。 可以证明,对于任何有限的数字字符串,都存在某个整数 $k$,使得该有限数字字符串作为子序列出现在第 $k$ 个 Champernowne 数中。 如果可以通过从字符串 $t$ 中删除某些(可能为零个)字符得到字符串 $s$,则称 $s$ 是 $t$ 的子序列。 给定一个数字字符串,计算使得该字符串成为第 $k$ 个 Champernowne 数的子序列的最小整数 $k$。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^5$),表示数字字符串的长度。 第二行包含一个长度为 $n$ 的数字字符串。

输出格式

输出一个整数 $k$,表示使得给定字符串成为第 $k$ 个 Champernowne 数的子序列的最小整数。

样例

样例输入 1

2
90

样例输出 1

10

样例输入 2

2
00

样例输出 2

20

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.