当前位置:网站首页>[Luogu p1403] Research on divisor
[Luogu p1403] Research on divisor
2022-06-13 09:35:00 【Ayane.】
analysis :
For each number k ( 1 < = k < = n ) k~(1<=k<=n) k (1<=k<=n) n n n The sum of the divisors of, i.e k k k The sum of all multiples of
CODE:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define reg register
using namespace std;
typedef long long ll;
int n,ans;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)
ans+=n/i;
printf("%d",ans);
return 0;
}
边栏推荐
猜你喜欢
Trees and binary trees: the concept of binary trees
C language: deep understanding of character functions and string functions (2)
Overloading of typical operators
Exploitation of competitive loopholes in attacking and defending world PWN play conditions
Consolas-with-Yahei
C language: minesweeping
(state compression dp+good) acwing 291 Mondrian's dream
Exercise 7-7 string replacement (15 points)
Solov2 nanny level tutorial (including environment configuration, training your own data set, code logic analysis, etc...) Updating ing
1-2 24:00 (20 points) [CSP certification true question]
随机推荐
Exception handling operation
(bfs) acwing 847. Hierarchy of points in the graph
Alibaba senior experts analyze the standard design of protocol
Z字形变换
@Value does not take effect and extend/implement other classes cannot inject beans manually
C language: sanziqi
C language: minesweeping
Exercise 8-3 rotate the array to the right (20 points)
Overloading of typical operators
LeetCode 201. 数字范围按位与
Yolov5 face video stream
Dpdk timer learning notes
Calculate the number of days between two times (supports cross month and cross year)
[ssl1280] full arrangement
C language: dynamic memory management
Timestamp to localdate
Can the operation of the new BMW I3 meet the expectations of the famous products of the 3 series?
LeetCode 202. Happy number
Zigzag transformation
(Dijkstra + shortest circuit + by point n^2) acwing 849 Dijkstra finding the shortest path I