QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓

#18270. 旧歌谣

Statistiques

怀念有收音机相伴的日子 不知道正在播放的是哪首歌

Akie 有一个非常古老的音乐播放器。该播放器可以依次播放 $x$ 首歌曲,并在屏幕上显示剩余的歌曲数量,记为 $x'$。最初,$x' = x$。每当一首歌曲播放完毕,$x'$ 就会减少 1,直到达到 0。然而,这个播放器的屏幕坏了,只能显示 $x'$ 的最高位数字;它无法显示 $x'$ 的精确值,也无法显示 $x'$ 的位数。

Akie 不知道 $x$ 的确切值,但她可以根据屏幕上显示的信息来推断 $x$ 的值。那么,Akie 至少需要等待播放多少首歌曲,才能确定 $x$ 的值?

输入格式

一行,包含一个整数 $x$ ($10 \le x \le 10^6$)。

注意:Akie 不知道 $x$ 的上限;对她来说,$x$ 可以是任何不小于 10 的正整数。

输出格式

输出一个整数,表示 Akie 为了确定 $x$ 的值而必须等待播放的最少歌曲数量。

样例

输入样例 1

33

输出样例 1

14

输入样例 2

789

输出样例 2

190

说明

在第一个样例中,最初 Akie 在屏幕上看到数字 3,并且在播放前 3 首歌曲后它没有发生变化。在接下来的 10 首歌曲中,屏幕上的数字变为 2,但此时她还不能排除像 303 或 3003 这样的数字。再播放一首歌曲后,屏幕上的数字变为 1,此时她就可以确定 $x$ 是 33。

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.