CF9C.Hexadecimal's Numbers
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbers from 1 to n to obtain total control over her energy.
But his plan failed. The reason for this was very simple: Hexadecimal didn't perceive any information, apart from numbers written in binary format. This means that if a number in a decimal representation contained characters apart from 0 and 1, it was not stored in the memory. Now Megabyte wants to know, how many numbers were loaded successfully.
一个美丽的七月清晨,主控机(Mainframe)中发生了一件可怕的事:一个邪恶的病毒“兆字节”(Megabyte)不知怎地获得了他同样邪恶的姐姐“十六进制”(Hexadecimal)的内存访问权限。他向其中载入了大量 $ n $ 个互不相同的自然数——即从 $ 1 $ 到 $ n $ 的所有整数——以完全掌控她的能量。
但他的计划失败了。原因非常简单:十六进制只接受二进制格式表示的数字信息。这意味着,若某个十进制表示的数字中包含除 0 和 1 以外的任何字符,则该数字不会被存储在内存中。现在,兆字节想知道:成功载入的数字有多少个?
输入格式
Input data contains the only number n (1 ≤ n ≤ 109).
输入数据仅包含一个数字 n(1 ≤ n ≤ 109)。
输出格式
Output the only number — answer to the problem.
输出唯一的数字——问题的答案。
输入输出样例
输入#1
10
输出#1
2
说明/提示
For n = 10 the answer includes numbers 1 and 10.
当 n=10 时,答案包含数字 1 和 10。
输入解题思路,AI测评打分。不知道怎么写?