OJ-Problems-Source/HDOJ/2620_autoAC.cpp
2016-08-24 18:19:33 +08:00

21 lines
400 B
C++

#include <cstdio>
using namespace std;
typedef long long LL;
int main()
{
LL n,k;
while(~scanf("%I64d%I64d",&n,&k)){
LL ans=n*k;
if(n>k) n=k;
for(LL i=1;i<=n;){
LL d=k/i;
LL j=k/d;
if(j>n) j=n;
ans-=d*(i+j)*(j-i+1)/2;
i=j+1;
}
printf("%I64d\n",ans);
}
return 0;
}