mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
21 lines
400 B
C++
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;
|
||
|
}
|