标签:求和 ring strong space cout https code amp org
分析
https://zzlzk.blog.luogu.org/solution-p2261
代码
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
int main(){
long long Ans,n,k,le=1,ri;
scanf("%lld%lld",&n,&k);
Ans=n*k;
for(;le<=n;le=ri+1){
if(k/le)ri=min(n,k/(k/le));
else ri=n;
Ans-=(k/le)*((ri-le+1)*(ri+le)/2);
}
cout<<Ans;
return 0;
}
标签:求和 ring strong space cout https code amp org
原文地址:https://www.cnblogs.com/yzxverygood/p/10354460.html