P2261 [CQOI2007]余数求和

include

include

include

include

include

include

include

include

define INF 525525

include

using namespace std;

long long n,k,ans;

int main()
{
cin >> n >> k;
ans=n*k;
for (int x=1,gx;x<=n;x=gx+1){
gx= k/x ? min(k/(k/x),n) : n;
ans-=(k/x) * (x+gx) * (gx-x+1) / 2;
}
printf("%ld\n",ans);
return 0;
}

posted @ 2020-06-11 16:15  _Buffett  阅读(80)  评论(0编辑  收藏  举报