/************************************************************** Problem: 1257 User: y20070316 Language: C++ Result: Accepted Time:8 ms Memory:804 kb ****************************************************************/ #include <cstdio> #include <cstring> #include <cstdlib> using namespace std; typedef long long LL; int n,m; LL sum; int main(void) { scanf("%d%d",&n,&m); sum+=(LL)n*m; if (n>m) n=m; int l,r,j; for (int i=1;i<=n;i=r+1) { j=m/i,l=m/(j+1)+1,r=m/j; if (r>=n) r=n; sum-=(LL)(l+r)*(r-l+1)*j/2; } printf("%lld\n",sum); return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/u013598409/article/details/47037031