C. Hexadecimal's Numbers
time limit per test

1 second

memory limit per test

64 megabytes

input

standard input

output

standard output

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.

Input

Input data contains the only number n (1 ≤ n ≤ 109).

Output

Output the only number — answer to the problem.

Examples
input
10
output
2
Note

For n = 10 the answer includes numbers 1 and 10.

由1 0 组成的数字,就是二进制数字的值!

把当前数字用10表示的最大数字,所代表的二进制的值就是答案。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<queue>
#include<deque>
#include<iomanip>
#include<vector>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<fstream>
#include<memory>
#include<list>
#include<string>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MAXN 503
#define N 33
#define MOD 10000007
#define INF 1000000009
const double eps = 1e-;
const double PI = acos(-1.0);
string str;
int main()
{
cin >> str;
bool f = false;
for (int i = ; i < str.size(); i++)
{
if (f) str[i] = '';
else if (str[i] > '')
{
str[i] = '';
f = true;
}
} LL ans = str[str.size() - ] - '', bas = ;
for (int i = str.size() - ; i >= ; i--)
{
bas *= ;
ans = ans + (str[i] - '')*bas;
}
cout << ans << endl;
return ;
}

最新文章

  1. jquery触屏幻灯片
  2. arch下的启动问题解决
  3. MMORPG大型游戏设计与开发(客户端架构 part11 of vegine)
  4. import static和import的区别
  5. 创建表 添加主键 添加列常用SQL语句
  6. 使用Node.js作为后台进行爬虫
  7. linux之screen命令
  8. 【Java数据结构】Java数据结构之链表反转
  9. ecstore在MySQL5.7下维护报错WARNING:512 @ ALTER IGNORE TABLE
  10. linux下安装tomcat,并设置自动启动
  11. JDBC整合c3p0数据库连接池 解决Too many connections错误
  12. Linux之命令的组合
  13. vue 添加旋转图片 修改css transform 值
  14. python 获取当前文件夹下所有文件名
  15. Asp.Net Core 通过自定义中间件防止图片盗链的实例(转)
  16. webpack学习笔记-2-file-loader 和 url-loader
  17. http请求的基本介绍
  18. 在VS2010中使用Git管理源代码
  19. 关于 Local feature 和 Global feature 的组合
  20. 关于Conversion to Dalvik format failed with error 1错误

热门文章

  1. 数学 Codeforces Round #219 (Div. 2) B. Making Sequences is Fun
  2. 295 Find Median from Data Stream 数据流的中位数
  3. jvm内存分区
  4. Android 简单的语音播报
  5. 用Python利用pyFirmata控制Arduino实现Blink
  6. Fiddler 修改响应内容
  7. CAD使用SetXData写数据(com接口)
  8. 梦想Android版CAD控件2019.01.23更新
  9. Spring框架系列(九)--MyBatis面试题(转载)
  10. ThinkPHP---TP拓展之获取IP信息