CF1062D Fun with Integers
思路:
找规律。
实现:
#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的更多相关文章
- [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 ...
- [LeetCode] Divide Two Integers 两数相除
Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- Leetcode Divide Two Integers
Divide two integers without using multiplication, division and mod operator. 不用乘.除.求余操作,返回两整数相除的结果,结 ...
- LeetCode Sum of Two Integers
原题链接在这里:https://leetcode.com/problems/sum-of-two-integers/ 题目: Calculate the sum of two integers a a ...
- 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 ...
- POJ 3468 A Simple Problem with Integers(线段树 成段增减+区间求和)
A Simple Problem with Integers [题目链接]A Simple Problem with Integers [题目类型]线段树 成段增减+区间求和 &题解: 线段树 ...
- 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 ...
- leetcode-【中等题】Divide Two Integers
题目 Divide two integers without using multiplication, division and mod operator. If it is overflow, r ...
随机推荐
- PHP/Javascript 数组定义 及JSON中的使用 ---OK
PHP数组定义 一维数组: 1.$a=array(1,2,4,5,6); 2.$a= Array("cec"=>"cecValue","logo ...
- POJ2752(next原理理解)
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 15536 Ac ...
- 设计模式学习笔记 1.factory 模式
Factory 模式 用户不关心工厂的具体类型,只知道这是一个工厂就行. 通过工厂的实现推迟到子类里面去来确定工厂的具体类型. 工厂的具体类型来确定生产的具体产品. 同时用户不关心这是一个什么样子的产 ...
- 利用vs自带工具分析程序性能
测试程序写好后可以通过VS2010分析菜单里选择启用性能向导 选择CPU采样后就选择需要分析的项目 测试项目选择完成后就可以运行分析,结束分析后VS2010会提供个详细报告文档 从分析结果来看GetC ...
- 1.131.15 Sqoop导出数据Export使用
一.export 1.export概述 export工具将一组文件从HDFS导入到RDBMS.目标表必须已经存在于数据库中.根据用户指定的分隔符读取输入文件并将其解析为一组记录, 只有map: [ro ...
- android opengl es 源码
[转自:http://blog.csdn.net/happyhell/article/details/6086973] The entire OpenGL ES API on Android is i ...
- easyui datagrid 列对不齐
function initBIRDataGrid(id,cols){ $('#basicTable').datagrid({ //列表区域 pageList: [5, 10, 15], fit:tru ...
- hrbust1444 逃脱 【BFS】
Description 这是mengxiang000和Tabris来到幼儿园的第四天,幼儿园老师在值班的时候突然发现幼儿园某处发生火灾,而且火势蔓延极快,老师在第一时间就发出了警报,位于幼儿园某处的 ...
- HDU2489【状压枚举】
题意: 给你n个点的图,然后让你在图里挑m个点,达到sumedge/sumnode最小 思路: 由于数据范围小,状压枚举符合m个点的状态,我是用vactor存了结点位置,也记录了结点的sum值,然后跑 ...
- DMOJ IOI '17 P3 - Toy Train【拓扑排序】
传送:https://dmoj.ca/problem/ioi17p3 参考:https://blog.csdn.net/qq_27327327/article/details/80711824 妙啊- ...