#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n>0&&n<10) cout<<n<<endl;
else if(n>9&&n<100) cout<<2*(n-9)+9<<endl;
else if(n>99&&n<1000) cout<<3*(n-99)+9+180<<endl;
else if(n>999&&n<10000) cout<<4*(n-999)+9+180+2700<<endl;
else if(n>9999&&n<100000) cout<<5*(n-9999)+9+180+2700+36000<<endl;
else if(n>99999&&n<1000000) cout<<6*(n-99999)+9+180+2700+36000+450000<<endl;
else if(n>999999&&n<10000000) cout<<7*(n-999999)+9+180+2700+36000+450000+5400000<<endl;
else if(n>9999999&&n<100000000) cout<<8*(n-9999999)+9+180+2700+36000+450000+5400000+63000000<<endl;
else cout<<9+180+2700+36000+450000+5400000+63000000+720000000+9<<endl;
return 0;
}

  

描述

当FourFire连续写下从十进制整数1开始到某个整数N之间的所有整数时,能得到如下的数字序列:                  12345678910111213141516171819202122… 编写一个程序,计算这个序列中的数字个数。

输入

输入的第一行且是唯一的一行包含:一个整数N,1≤N≤100,000,000。

输出

输出的第一行且是唯一的一行应包含:由给定的整数所产生的序列的数字个数。

样例输入

15

样例输出

21

1842-A. Broj的更多相关文章

  1. codevs——1842 递归第一次

    1842 递归第一次  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 白银 Silver 题解       题目描述 Description 同学们在做题时常遇到这种函数 f( ...

  2. bzoj3181: [Coci2012]BROJ

    #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...

  3. BZOJ 3181 BROJ

    像我这种SB还是早点退役. #include<iostream> #include<cstdio> #include<cstring> #include<al ...

  4. zoj 1842 Prime Distance

    // 数论题,增强的筛法,回想素数筛法 // 只要筛到最大数的开方,剩下的就是素数 // 于是这里,开一个 sqrt(2^31) 大约 65536 的素数表,然后 // 对于每个 L~U 的区间,筛掉 ...

  5. ZOJ 1842 Prime Distance(素数筛选法2次使用)

    Prime Distance Time Limit: 2 Seconds      Memory Limit: 65536 KB The branch of mathematics called nu ...

  6. bzoj AC倒序

    Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...

  7. (转) [it-ebooks]电子书列表

    [it-ebooks]电子书列表   [2014]: Learning Objective-C by Developing iPhone Games || Leverage Xcode and Obj ...

  8. sencha ext js 6 入门

    Sencha Ext JS号称是目前世界上最先进和最强大的.支持多平台多设备的JavaScript应用程序开发框架.首先看一下Ext JS的发展简史. 1 Ext JS发展简史 YUI-Ext的作者J ...

  9. CODEVS 天梯 代码记录

    所有水题均被折叠 Lv.1 青铜 1201 #include<iostream> #include<cstring> #include<algorithm> #in ...

随机推荐

  1. 注册Model类

    根据username查找是否存在相同的用户名的方法 自动填充功能填充注册时间字段 如果两次输入的密码一直则写入数据库的方法 userModel.class.php <?php /**** 燕十八 ...

  2. 深入理解java的抽象类和接口(转载)

    原文链接:http://www.cnblogs.com/dolphin0520/p/3811437.html 对于面向对象编程来说,抽象是它的一大特征之一.在Java中,可以通过两种形式来体现OOP的 ...

  3. while循环语句

    while(循环条件,返回布尔类型)            {                代码执行的操作,或者打印输出. } do  whilw循环 do            {         ...

  4. SAX方式解析XML文件实例

    books.XML文件: 书籍book.java实体类: public class Book { private String id; private String name; private Str ...

  5. iOS崩溃日志分析

    Incident Identifier: 55864905-937C-4172-B435-2ACA13D3070ECrashReporter Key: b85cab13431711060a5fab55 ...

  6. Java实战之02Hibernate-06处理并发

    十三.处理并发 1.事务的隔离级别 不考虑隔离级别出现的问题: 脏读:一个线程中的事务读到了另外一个线程中未提交的数据. 不可重复读:一个线程中的事务读到了另外一个线程中提交的update(更新)的数 ...

  7. Java7 switch新特性

    在Java7之前,switch只能匹配整数值,和字符:而Java7添加了字符串的匹配特性. 代码如下: package blog; public class Main { public static ...

  8. iOS应用数据存储的常用方式

    iOS应用 数据存储的常用方式 XML属性列表 plist Preference 偏好设置 NSKeyedArchiver 归档 Core Data SQLite3 应用沙盒: Layer:     ...

  9. css3太极图效果+自动旋转

    主要使用border-radius属性实现圆,半圆,定位坐标覆盖部分模块. 半圆: width: 50%; height: 100%; border-radius:100% 0 0 100% /50% ...

  10. Cassandra1.2文档学习(7)—— 规划集群部署

    数据参考:http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/architecture/a ...