B1968 [Ahoi2005]COMMON 约数研究 数论
2024-08-31 08:33:12
大水题,一分钟就做完了。。。直接枚举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 ;
}
最新文章
- esri联邦用户大会 总结
- Java -- File
- NGINX 定时器
- RGB
- 九度-剑指Offer
- C++学习23 虚函数详解
- C#三大支柱之继承
- IOSTimer的例子留个备注
- 关于封装的一个小问题和TA的例子
- Android中的PopupWindow的使用
- winform datagridview 添加行号。
- javascript模式——Facade
- HDU 1253-大逃亡(裸-DBFS)
- [Erlang危机](5.1.0)VM检测概述
- Spring + qyartz+多任务实现任务调度功能。
- 探索 Java 热部署
- JavaScript系统对象
- 【Zabbix3.0】之入门到精通
- spring学习 三 框架的搭建
- Unity3D 中鼠标按下时OnMouseDown()、Input.GetMouseButtonDown()和EventType.MouseDown的响应验证
热门文章
- nprogress进度条和ajax全局事件
- 努比亚(nubia) M2青春版 NX573J 解锁BootLoader 并进入临时recovery ROOT
- 4星|《OKR实践指南》:老司机经验谈
- Python批量添加库搜索路径
- 【sqli-labs】 less43 POST -Error based -String -Stacked with tiwst(POST型基于错误的堆叠变形字符型注入)
- tomcat映射java目录 sever.xml
- kvm介绍、安装及创建虚拟机
- SYN 和 RTO
- 通过JDBC取Oracle数据库的时间字段时,时间丢失,只剩日期
- 15.id生成的两种方式