分析:一段区间的整数除法得到的结果肯定是相等的,然后找就行了,每次是循环一段区间,暴力

#include <cstdio>
#include <iostream>
#include <ctime>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const int N=5e4+;
const int INF=0x3f3f3f3f;
int main()
{
int cas=,T;
scanf("%d",&T);
while(T--){
LL n;
scanf("%lld",&n);
LL ans=n;
for(LL i=;i<=n;++i){
LL tmp=n/i;
LL pos=n/tmp;
ans=ans+(pos-i+)*tmp;
i=pos;
}
printf("Case %d: %lld\n",++cas,ans);
}
return ;
}
04-19 20:57
查看更多