题解 : 这题巨水。。 我们认为数字大小为i的数字在i-n范围内的倍数有n/i个, 所以 这道题就做完了QAQ
#include<bits/stdc++.h> #define ll long long const int INF = 0x7fffffff; const double eps = 1e-5; using namespace std; int read() { int x = 0 , f = 1; char ch = getchar(); while(ch<'0'||ch>'9') {if(ch=='-')f*=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+(ch-'0');ch=getchar();} return x * f; } int n,asn; int main() { n = read(); for(int i = 1 ; i <= n ; i++) asn += n / i; cout<<asn; }