不用 ACL!
ll fs(ll n,ll m,ll a,ll b){
ll res=0;
if (a>=m){
res+=n*(n+1)/2*(a/m),a%=m;
}
if (b>=m){
res+=(n+1)*(b/m),b%=m;
}
ll c=(a*n+b)/m;
if (!c){
return res;
}
res+=n*c-fs(c-1,a,m,m-b-1);
return res;
}
标签:fs,Calculate,floor,res,sum,ll
From: https://www.cnblogs.com/SFlyer/p/17611373.html