数学 Codeforces Round #308 (Div. 2) B. Vanya and Books
2024-08-30 18:30:11
/*
水题:求总数字个数,开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 ;
}
最新文章
- 多个jar包合并成一个jar包的办法
- jQuery读取和设定KindEditor的值
- Python中的编码
- iOS - C 基本语法
- frameset框架下,刷新整个页面
- 快学Scala习题解答—第一章 基础
- interview(转)
- Android学习——移植tr069程序到Android平台
- 在Windows、Mac和 Linux系统中安装Python与 PyCharm
- Checkpoint 和Breakpoint
- Nginx+Tomcat整合的安装与配置(win.linux)
- 正则表达式matcher.group()用法
- axios 设置拦截器 全局设置带默认参数(发送 token 等)
- centos7搭建.netcore运行环境
- (转)<;Unity3D>;Unity3D在android下调试
- JDK自带工具之问题排查场景示例
- DateFormat 线程安全
- Web前端页面的浏览器兼容性测试心得(二)搭建原汁原味的IE8测试环境
- C# ContentType: ";application/json"; 请求方式传json参数问题
- iptables详解(13):iptables动作总结之二