数学 Codeforces Round #308 (Div. 2) B. Vanya and Books
/*
水题:求总数字个数,开long long竟然莫名其妙WA了几次,也没改啥又对了:)
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
using namespace std; typedef long long ll;
const int MAXN = 1e2 + ;
const int INF = 0x3f3f3f3f; int main(void) //Codeforces Round #308 (Div. 2) B. Vanya and Books
{
// freopen ("B.in", "r", stdin); ll n;
while (scanf ("%I64d", &n) == )
{
int len = ; ll tmp = n;
while (tmp)
{
tmp /= ; len++;
} ll ans = ; ll x = ;
for (int i=; i<=len-; ++i)
{
ans += x * i; x *= ;
}
ll y = ;
for (int i=; i<=len-; ++i) y *= ; ans += (n - y + ) * len;
printf ("%I64d\n", ans);
} return ;
}
数学 Codeforces Round #308 (Div. 2) B. Vanya and Books的更多相关文章
- Codeforces Round #308 (Div. 2)B. Vanya and Books 数学
B. Vanya and Books Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/pr ...
- 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table
题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...
- 暴力/进制转换 Codeforces Round #308 (Div. 2) C. Vanya and Scales
题目传送门 /* 题意:问是否能用质量为w^0,w^1,...,w^100的砝码各1个称出重量m,砝码放左边或在右边 暴力/进制转换:假设可以称出,用w进制表示,每一位是0,1,w-1.w-1表示砝码 ...
- Codeforces Round #308 (Div. 2) D. Vanya and Triangles 水题
D. Vanya and Triangles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55 ...
- Codeforces Round #308 (Div. 2) C. Vanya and Scales dfs
C. Vanya and Scales Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/p ...
- Codeforces Round #308 (Div. 2) A. Vanya and Table 暴力
A. Vanya and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/pr ...
- Codeforces Round #308 (Div. 2)----C. Vanya and Scales
C. Vanya and Scales time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet
题目传送门 /* 贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2 */ #include <cstdio> #include <al ...
- 数学 Codeforces Round #219 (Div. 2) B. Making Sequences is Fun
题目传送门 /* 数学:这题一直WA在13组上,看了数据才知道是计算cost时超long long了 另外不足一个区间的直接计算个数就可以了 */ #include <cstdio> #i ...
随机推荐
- .NET 之 ORM 性能评测
.NET 之 ORM 性能评测 Why 你应该总能听到某ORM性能比Dapper高 你应该有如下疑问: 基准测试是否权威 基准测试的方式是否合理 基准测试的标准是否能够统一 统一基准测试标准/规范 如 ...
- L0、L1与L2范数
监督机器学习问题无非就是“minimize your error while regularizing your parameters”,也就是在正则化参数的同时最小化误差.最小化误差是为了让我们的模 ...
- 【转】Wireshark技巧-过滤规则和显示规则
原文: http://www.cnblogs.com/icez/p/3973873.html ----------------------------------------------------- ...
- 同一个页面多个html、body标签
同一个页面多个html.body标签 html页面的一些标签,默认只有一个.比如html,head,body..... 如果写多个是什么情况呢.本着好奇的想法,试验了一下. <html> ...
- LoaderManager使用具体解释(四)---实例:AppListLoader
实例:AppListLoader 这篇文章将是我的第四篇,也就是最后一篇该系列的文章.请在评论里面告诉我他们是否实用.前面几篇文章的链接例如以下: 一:Loaders之前世界 二:了解LoaderMa ...
- vector draw 试用期结束的 激活方法
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Licenses\DBEA4D42-0745-428e-B17A-A5B6CA3AB34B] 把这个注冊表给删 了
- ubuntu下,创建ruby环境时出现 checking for Magick-config... no
解决:sudo apt-get install libmagickcore-dev libmagickwand-dev
- Linux操作服务器的初识
1,服务器:顾名思义就是提供服务的机器,(超强性能的一台主机, 100G-500G内存) 2,运维自动化 运维人员, 一个人维护上百台服务器 3,CMDB运维资产管理平台 资产收集, 通过web界面, ...
- Java中抽象类和接口的区别?
深入理解Java的接口和抽象类 对于面向对象编程来说,抽象是它的一大特征之一.在Java中,可以通过两种形式来体现OOP的抽象:接口和抽象类.这两者有太多相似的地方,又有太多不同的地方.很多人在初学的 ...
- 初识NodeJS服务端开发(Express+MySQL)
http://www.alloyteam.com/2015/03/sexpressmysql/