思路:

找规律。

实现:

 #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n;
while (cin >> n)
{
ll cnt = ;
for (int i = ; i * i <= n; i++)
{
ll tmp = n / i;
cnt += (i + + tmp) * (tmp - i) / ;
cnt += (tmp - i + ) * i;
}
cout << (cnt << ) << endl;
}
return ;
}

CF1062D Fun with Integers的更多相关文章

  1. [LeetCode] Sum of Two Integers 两数之和

    Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Exam ...

  2. [LeetCode] Divide Two Integers 两数相除

    Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...

  3. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  4. Leetcode Divide Two Integers

    Divide two integers without using multiplication, division and mod operator. 不用乘.除.求余操作,返回两整数相除的结果,结 ...

  5. LeetCode Sum of Two Integers

    原题链接在这里:https://leetcode.com/problems/sum-of-two-integers/ 题目: Calculate the sum of two integers a a ...

  6. Nim Game,Reverse String,Sum of Two Integers

    下面是今天写的几道题: 292. Nim Game You are playing the following Nim Game with your friend: There is a heap o ...

  7. POJ 3468 A Simple Problem with Integers(线段树 成段增减+区间求和)

    A Simple Problem with Integers [题目链接]A Simple Problem with Integers [题目类型]线段树 成段增减+区间求和 &题解: 线段树 ...

  8. LeetCode 371. Sum of Two Integers

    Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Exam ...

  9. leetcode-【中等题】Divide Two Integers

    题目 Divide two integers without using multiplication, division and mod operator. If it is overflow, r ...

随机推荐

  1. 实现虚拟机VMware上linux与windows互相复制与粘贴

    from:http://blog.csdn.net/u012243115/article/details/40454063 系统环境: win7系统,虚拟机VMwareWorkstation上运行的C ...

  2. HDU2546(01背包变形)

    饭卡 Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submissi ...

  3. 51nod1228

    伯努利数 这个是答案 其中的b是伯努利数,可以n^2预处理 伯努利数n^2递推 #include<bits/stdc++.h> using namespace std; typedef l ...

  4. Redis的小白应用

    在window下测试学习redis 步骤: 1.先下载安装 redis,(conf文件制定配置文件(redis-server.exe  redis.conf ),若不指定则默认), 基本上我是直接点击 ...

  5. css3单位em,rem,px,vw,vh等

    昨天发现了个好用的方法去设置手机端的rem单位,在这里记录下. html{ font-size:calc(100vw/7.5);} 这是按照750的设计稿(也就是iphone6的设计稿). 100vw ...

  6. CodeForces 1098D. Eels

    题目简述:对一个非空正整数(可重)集合$S$,从中选出两个元素$a, b (a \leq b)$,将他们从$S$中删除并将$a+b$加入$S$,重复这个操作直到$S$中只剩下一个元素为止,称为一次[竞 ...

  7. C++ TUTORIAL - MEMORY ALLOCATION - 2016

    http://www.bogotobogo.com/cplusplus/memoryallocation.php Variables and Memory Variables represent st ...

  8. 11.ClientCredential模式总结

    11.ClientCredential模式总结 服务端定义的Resource叫做api Resource API默认是被保护的 第三方的客户端先去请求 Server拿到access token.带着t ...

  9. ASP.NET Core MVC 2.x 全面教程_ASP.NET Core MVC 25. 过滤器

    在MVC的请求管道 并不是  asp.net core的请求管道.所以说Filter是专用于MVC的 贯穿特性,横穿关注点.比如授权.日志 这里的Authorize其实就是一个Filter,主要用来授 ...

  10. js点击复制某段文本方法

    百度很多说这个方法 window.clipboardData.setData ("Text", "demo"); 实践证明只有ie支持. 改成下面这个方式来复制 ...