思路:

找规律。

实现:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 typedef long long ll;
 4 int main()
 5 {
 6     ll n;
 7     while (cin >> n)
 8     {
 9         ll cnt = 0;
10         for (int i = 2; i * i <= n; i++)
11         {
12             ll tmp = n / i;
13             cnt += (i + 1 + tmp) * (tmp - i) / 2;
14             cnt += (tmp - i + 1) * i;
15         }
16         cout << (cnt << 2) << endl;
17     }
18     return 0;
19 }

转载于:https://www.cnblogs.com/wangyiming/p/9977600.html

CF1062D Fun with Integers相关推荐

  1. pandas将dataframe原有的数据列名称转化为整数数值列名称(convert dataframe column labelsl into integers)

    pandas将dataframe原有的数据列名称转化为整数数值列名称(convert dataframe column labelsl into integers) 目录 pandas将datafra ...

  2. [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 ...

  3. “TypeError: list indices must be integers or slices, not str”有关报错解决方案

    "TypeError: list indices must be integers or slices, not str"有关报错解决方案 参考文章: (1)"TypeE ...

  4. python3 错误string indices must be integers 的解决方法

    这个错误意思是字符串的下标一定要是整数 出这种错误有多种可能,最形象直接的就是: a = '[abc]' print(a['0']) 有点pyhton基础的都知道下标怎么能是字符串'0',必须是整数0 ...

  5. list indices must be integers or slices, not tuple

    11年it研发经验,从一个会计转行为算法工程师,学过C#,c++,java,android,php,go,js,python,CNN神经网络,四千多篇博文,三千多篇原创,只为与你分享,共同成长,一起进 ...

  6. 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 ...

  7. MATLAB报错“Integers can only be raised to positive integral powers.“

    报错代码是下面这样的: I=imread('pout.jpg'); if size(I,3)>1  %判断如果是彩色图像,转换为灰度图     I=rgb2gray(I); end Gamma_ ...

  8. Divide Two Integers

    Divide two integers without using multiplication, division and mod operator. 思路:不能使用乘法除法以及取模运算来计算两个数 ...

  9. leetcode之Divide Two Integers

    题目:Divide Two Integers Divide two integers without using multiplication, division and mod operator. ...

  10. 成功解决ValueError: ‘usecols‘ must either be list-like of all strings, all unicode, all integers or a ca

    成功解决ValueError: 'usecols' must either be list-like of all strings, all unicode, all integers or a ca ...

最新文章

  1. 从Python到AI,这条路好走吗?
  2. 【Unity 3D】学习笔记三十六:物理引擎——刚体
  3. redis启动问题:/var/redis/run/redis_6379.pid exists, process is already running or crashed
  4. [NHibernate]事务
  5. VC/MFC如何设置对话框背景颜色
  6. 洛谷——P1583 魔法照片
  7. python property作用_python中@property的作用和getter setter的解释
  8. 正确的python变量名_在Python,如何将变量名作为字符串?_others_酷徒编程知识库...
  9. excel删除行 uipath_UiPath之常见问题集锦(二)
  10. 提高学生对计算机学科学习兴趣的研究的结题报告,《如何在体育教学中运用体育游戏》的研究结题报告...
  11. 【爬虫剑谱】二卷4章 实战篇-模拟登录铁路12306网站(滑块验证)
  12. C++使用VARIANT实现二维数组的操作
  13. cas → 注销登录后跳转到登录页
  14. VS Code下载安装教程
  15. CrossApp V1.0.1,新增动画与连接 wifi 功能
  16. uni实现前端分页功能
  17. java 斑马 打印不出来_通过PrintServer将原始ZPL发送到Zebra打印机不起作用
  18. 自定义ViewGroup
  19. 统计检验的基本原理(异常值检验)
  20. java do po dto_彻底搞懂DAO,PO,BO,DTO,VO,DO

热门文章

  1. 苹果mac光标自行移动如何解决?
  2. 在 Mac 上拷贝(复制)、粘贴的方法
  3. 苹果Mac软件开发工具:Xcode 让开发者如虎添翼
  4. 如何在Mac上强制退出应用
  5. HashMap 在 JDK 1.8 中新增的数据结构 – 红黑树
  6. 扎克伯格正用“山寨”策略碾压Snapchat
  7. 36家健康类公益组织联名举报百度
  8. Android 程序调试
  9. Prefer copy Over retain
  10. jQery动态添加删除类样式