题解:
显然每一个数对答案的贡献为n/i
代码:
#include<bits/stdc++.h> using namespace std; int n; int main() { scanf("%d",&n); int ans=0; for (int i=1;i<=n;i++)ans+=n/i; printf("%d",ans); }