Zcr and yy is a lot of ridicule in turn, felt IQ declining. . . T_T
Mod first split into integer division, and it is $ nk- \ Sigma_ {i = 1} ^ {n} i * \ lfloor \ frac {k} {i} \ rfloor $. Seek behind that.
And then found $ \ lfloor \ frac {k} {i} \ rfloor $ is continuous and monotonically growing. For $ x $, $ [x, \ lfloor \ frac {k} {\ lfloor \ frac {k} {i} \ rfloor} \ rfloor] $ within the same supplier. You can sense.
This is to find the law to get, and will not permit QWQ. So each segment as a quotient multiplied by each $ i $ this period of accumulation.
Complexity is $ i \ leq \ sqrt {k} have $ \ sqrt {k} $ $ when seed supplier. $ I \ geq \ sqrt {k} and Suppliers less than $ \ sqrt {k} $ $ time also up to $ \ sqrt {k} $ species. Thus the complexity is the root.
WA: the right thing and every point of the interval to be sentenced on longlong exceeds $ n $.
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 using namespace std; 7 typedef long long ll; 8 template<typename T>inline T _min(T A,T B){return A<B?A:B;} 9 template<typename T>inline T read(T&x){ 10 x=0;int f=0;char c;while(!isdigit(c=getchar()))if(c=='-')f=1; 11 while(isdigit(c))x=x*10+(c&15),c=getchar();return f?x=-x:x; 12 } 13 inline ll sum(ll i,ll j){return (i+j)*(j-i+1)/2;} 14 ll ans,n,k; 15 16 int main(){//freopen("test.in","r",stdin);//freopen("test.out","w",stdout); 17 read(n),read(k);ans=n*k;(n>k)&&(n=k); 18 for(register ll i=1,r=0;i<=n;i=r+1)ans-=sum(i,r=_min(n,k/(k/i)))*(k/i); 19 return printf("%lld\n",ans),0; 20 }