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 ;
}

C. Hexadecimal's Numbers的更多相关文章

  1. codeforces 9 div2 C.Hexadecimal's Numbers 暴力打表

    C. Hexadecimal's Numbers time limit per test 1 second memory limit per test 64 megabytes input stand ...

  2. Codeforces Beta Round #9 (Div. 2 Only) C. Hexadecimal's Numbers dfs

    C. Hexadecimal's Numbers 题目连接: http://www.codeforces.com/contest/9/problem/C Description One beautif ...

  3. Codeforce 9C - Hexadecimal's Numbers

    One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got ...

  4. 9 C. Hexadecimal's Numbers

    题目链接 http://codeforces.com/contest/9/problem/C 题目大意 输入n,计算出n之内只有0和1组成的数字的数量 分析 k从1开始,只要小于n,就给sum++,并 ...

  5. Codeforces 9C Hexadecimal's Numbers - 有技巧的枚举

    2017-08-01 21:35:53 writer:pprp 集训第一天:作为第一道题来讲,说了两种算法, 第一种是跟二进制数联系起来进行分析: 第二种是用深度搜索来做,虽然接触过深度搜索但是这种题 ...

  6. SH Script Grammar

    http://linux.about.com/library/cmd/blcmdl1_sh.htm http://pubs.opengroup.org/onlinepubs/9699919799/ut ...

  7. man bash

    BASH(1) General Commands Manual BASH(1) NAME bash - GNU Bourne-Again SHell SYNOPSIS bash [options] [ ...

  8. dhcpd.conf(5) - Linux man page

    http://linux.die.net/man/5/dhcpd.conf Name dhcpd.conf - dhcpd configuration file Description   The d ...

  9. bash5.0参考手册

    Bash Reference Manual a.summary-letter { text-decoration: none } blockquote.indentedblock { margin-r ...

随机推荐

  1. POJ 2773 欧几里得

    思路: 若a和b互素的话,则b*t+a和b一定互素 用周期性做就好了 //By SiriusRen #include <cstdio> using namespace std; ],m,k ...

  2. 初窥Android Studio

    Android Studio 是一个Android集成开发工具,基于IntelliJ IDEA. 类似 Eclipse ADT,Android Studio 提供了集成的 Android 开发工具用于 ...

  3. C/C++自实现的函数(memset, memcpy, atoi)

    函数原型: void * memset ( void * buffer, int c, size_t num ); 关于void * 因为任何类型的指针都可以传入memset函数,这也真是体现了内存操 ...

  4. [Python实战] 功能简单的数据查询及可视化系统

    前言 数据时代,数据的多源集成和快速检索查询是第一步,配上数据分析及可视化才能算窥得大数据一角. 创建这个项目的主要目的一是对前期工作的一些总结,二是提升自己. 这里简单介绍一下sqlpro这个项目的 ...

  5. A8ERP权限管理系统

  6. 简单3步,你即可以用上myFocus

    Step 1. 在html的标签内引入相关文件 <script type="text/javascript" src="js/myfocus-2.0.0.min.j ...

  7. P1165 日志分析

    题目描述 M 海运公司最近要对旗下仓库的货物进出情况进行统计.目前他们所拥有的唯一记录就是一个记录集装箱进出情况的日志.该日志记录了两类操作:第一类操作为集装箱入库操作,以及该次入库的集装箱重量:第二 ...

  8. web测试--登录界面怎么测?

    具体需求: 有一个登陆页面, 上面有2个textbox, 一个提交按钮.  请针对这个页面设计30个以上的测试用例. 此题的考察目的: 面试者是否熟悉各种测试方法,是否有丰富的Web测试经验, 是否了 ...

  9. Python3.4的Pillow库实现验证码图片

    转自 http://blog.csdn.net/bin381/article/details/41969493 from PIL import Image,ImageDraw, ImageFont, ...

  10. 第一次创建svn的项目的使用方法

    1.第一步.在服务器上创建svn项目,将开发人人员你的账号密码添加上去. 2.第二步.开始在本地创建一个文件夹,点文件夹,右键->tortoisSVN->repo-brower 填写svn ...