大水题,一分钟就做完了。。。直接枚举1~n就行了,然后在n中判断出现多少次。

题干:

Description

Input

只有一行一个整数 N(0 < N < 1000000)。

Output

只有一行输出,为整数M,即f(1)到f(N)的累加和。

Sample Input

3

Sample Output

5

HINT

Source

代码:

#include<iostream>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<queue>
#include<algorithm>
#include<cstring>
using namespace std;
#define duke(i,a,n) for(ll i = a;i <= n;i++)
#define lv(i,a,n) for(int i = a;i >= n;i--)
#define clean(a) memset(a,0,sizeof(a))
const int INF = << ;
typedef long long ll;
typedef double db;
template <class T>
void read(T &x)
{
char c;
bool op = ;
while(c = getchar(), c < '' || c > '')
if(c == '-') op = ;
x = c - '';
while(c = getchar(), c >= '' && c <= '')
x = x * + c - '';
if(op) x = -x;
}
template <class T>
void write(T x)
{
if(x < ) putchar('-'), x = -x;
if(x >= ) write(x / );
putchar('' + x % );
}
ll n,tot = ;
int main()
{
read(n);
duke(i,,n)
{
tot += n / i;
}
write(tot);
return ;
}

最新文章

  1. esri联邦用户大会 总结
  2. Java -- File
  3. NGINX 定时器
  4. RGB
  5. 九度-剑指Offer
  6. C++学习23 虚函数详解
  7. C#三大支柱之继承
  8. IOSTimer的例子留个备注
  9. 关于封装的一个小问题和TA的例子
  10. Android中的PopupWindow的使用
  11. winform datagridview 添加行号。
  12. javascript模式——Facade
  13. HDU 1253-大逃亡(裸-DBFS)
  14. [Erlang危机](5.1.0)VM检测概述
  15. Spring + qyartz+多任务实现任务调度功能。
  16. 探索 Java 热部署
  17. JavaScript系统对象
  18. 【Zabbix3.0】之入门到精通
  19. spring学习 三 框架的搭建
  20. Unity3D 中鼠标按下时OnMouseDown()、Input.GetMouseButtonDown()和EventType.MouseDown的响应验证

热门文章

  1. nprogress进度条和ajax全局事件
  2. 努比亚(nubia) M2青春版 NX573J 解锁BootLoader 并进入临时recovery ROOT
  3. 4星|《OKR实践指南》:老司机经验谈
  4. Python批量添加库搜索路径
  5. 【sqli-labs】 less43 POST -Error based -String -Stacked with tiwst(POST型基于错误的堆叠变形字符型注入)
  6. tomcat映射java目录 sever.xml
  7. kvm介绍、安装及创建虚拟机
  8. SYN 和 RTO
  9. 通过JDBC取Oracle数据库的时间字段时,时间丢失,只剩日期
  10. 15.id生成的两种方式