格式难调,题面就不放了。
分析:
实际上这个就是这道题的升级版,没什么可讲的,数论分块搞就是了。
Code:
//It is made by HolseLee on 18th Jul 2019 //Luogu.org P3935 #include<bits/stdc++.h> #define mod 998244353 using namespace std; typedef long long ll; ll l,r,ans; int main() { cin>>l>>r; l--; for(ll i=1,j; i<=r; i=j+1) { j=r/(r/i); ans=(ans+(r/i)*(j-i+1)%mod)%mod; } for(ll i=1,j; i<=l; i=j+1) { j=l/(l/i); ans=(ans-(l/i)*(j-i+1)%mod+mod)%mod; } cout<<ans<<' '; return 0; }