Codeforces Round #308 (Div. 2) Vanya and Books
来源:互联网 发布:sql 多个查询结果合并 编辑:程序博客网 时间:2024/05/21 09:22
题目链接:http://codeforces.com/contest/552/problem/B
题意:就是求有几个数字;
eg:13:1 2 3 4 5 6 4 7 8 9 1 0 1 1 1 2 1 3
一共17个数字
#include <iostream>using namespace std;long long a[12]={0,9,99,999,9999,99999,999999,9999999,99999999,999999999,9999999999};int main(){ long long m; while(cin>>m) { long long k=1,sum=0;注意是long long if(m<10) { cout<<m<<endl; continue; } else { for(int i=1; i<=10; i++) { k*=10; if(m<k) { sum+=(m-k/10+1)*i; break; } else sum+=(a[i]-a[i-1])*i; } cout<<sum<<endl; } } return 0;}
0 0
- B. Vanya and Books(Codeforces Round #308 (Div. 2))
- Codeforces Round #308 (Div. 2) Vanya and Books
- Codeforces Round #308 (Div. 2) B. Vanya and Books
- B. Vanya and Books( Codeforces Round #308 (Div. 2) 简单题)
- #308 (div.2) B. Vanya and Books
- A. Vanya and Table(Codeforces Round #308 (Div. 2))
- C. Vanya and Scales(Codeforces Round #308 (Div. 2))
- D. Vanya and Triangles(Codeforces Round #308 (Div. 2))
- E. Vanya and Brackets(Codeforces Round #308 (Div. 2))
- Codeforces Round #308 (Div. 2) A. Vanya and Table
- Codeforces Round #308 (Div. 2) C. Vanya and Scales
- Codeforces Round #308 (Div. 2) D. Vanya and Triangles
- Codeforces Round #308 (Div. 2) E. Vanya and Brackets
- Codeforces Round #308 (Div. 2) C.Vanya and Scales
- Codeforces Round #308 (Div. 2) D Vanya and Triangles
- Codeforces Round #308 (Div. 2) C. Vanya and Scales dfs
- Codeforces Round #235 (Div. 2) A. Vanya and Cards
- Codeforces Round #280 (Div. 2) E. Vanya and Field
- unix环境高级编程——文件i/o
- flv播放器代码
- 使用jquery+ajax+php实现搜索框的功能
- 动态规划算法,最小代价
- 自己的代码的异常的设计案例
- Codeforces Round #308 (Div. 2) Vanya and Books
- 最近
- 从页面提交表单数据的方法之(一)
- android 使用Scroller实现缓慢移动
- MFC 与Excel文件的交互操作
- Linux下静态库_库的基本概念;如何生成静态库动态库;nm查看库中包含那些函数、ar生成静态库,查看库中包含那些.o文件、ldd查看程序依赖的.so文件;
- redis文档翻译_key设置过期时间
- 后缀数组——倍增算法
- JDK和JRE SE、EE和ME