d(x)表示x的约数个数,让你求(l,r<=10^12,r-l<=10^6,k<=10^7)
#includeusing namespace std;#define MOD 998244353ll#define MAXP 1000100typedef long long ll;ll x,y;int T,K;bool isNotPrime[MAXP+10];int num_prime,prime[MAXP+10];void shai(){ for(long i = 2 ; i < MAXP ; i ++) { if(! isNotPrime[i]) prime[num_prime ++]=i; for(long j = 0 ; j < num_prime && i * prime[j] < MAXP ; j ++) { isNotPrime[i * prime[j]] = 1; if( !(i % prime[j])) break; } } }ll b[1000010],a[1000010];int main(){ scanf("%d",&T); shai(); for(;T;--T){ scanf("%lld%lld%d",&x,&y,&K); for(ll i=x;i<=y;++i){ a[i-x+1ll]=i; b[i-x+1ll]=1; } for(int i=0;i 1ll)){ b[i-x+1ll]=(b[i-x+1ll]*((ll)K+1ll))%MOD; } ans=(ans+b[i-x+1ll])%MOD; } printf("%lld\n",ans); } return 0;}