Description
Hint
T <= 10000
N, m<=10000000
Solution
Almost the same as the Bzoj 2154 number table, except that the question becomes multiple groups, and the complexity of the previous one is too much.
Still write the answer
and two more enumerators.
We try to change the sum of the indicator + prefix and continue to subtract an enumerator
And then there's the
For this thing we define it as H (D)
Enables prefixes and preprocessing.
Consider the multiple of enumerations I and I
But this kind of treatment is obviously not acceptable.
It seems that only the complexity of O (n) can be accepted
Can you put h in a linear sieve and handle it?
For a prime p, its new μ value is obviously p-p^2.
If P is the product of the first term of multiple primes
Obviously H is the integrable h (p) = h (p1) * H (p2) * H (P3) ...
If the only decomposition of P can be written as a part of the prime product I and another part in the previous part of the number of the number of the product J, that is, the exponent of the existence of the mass factor is greater than 1, it added each factor of the μ value is 0, no meaning, only the statistical d becomes the original J times
So at this point h (p) = h (i) * j
Prefix and add it at a later moment.
1#include <bits/stdc++.h>2 3 #defineMoD 1000000094 #defineMaxp 100000005 #defineMAXN 10000000+56 #defineSet (a B) memset (A, (b), sizeof (a))7 #defineFR (i,a,b) for (ll i= (a), _end_= (b); i<=_end_;i++)8 #defineRF (I,b,a) for (ll i= (a), _end_= (b); i>=_end_;i--)9 #defineFe (I,A,B) for (int i=first[(b)],_end_= (a); i!=_end_;i=s[i].next)Ten #defineFEC (I,A,B) for (int &i=cur[(b)],_end_= (a); i!=_end_;i=s[i].next) One A using namespacestd; - -typedefLong Longll; the - ll F[MAXN],H[MAXN]; - ll ans; - intprime[maxn],pri[maxn],tot=0; + intn,m,t; - + voidRead () A { at #ifndef Online_judge -Freopen ("2693.in","R", stdin); -Freopen ("2693.out","W", stdout); - #endif - //cin >> T; -scanf"%d",&T); in } - to voidWrite () + {} - the voidprint () * { $ //cout << ans << endl;Panax Notoginsengprintf"%lld\n", ans); - } the + void Get() A { theh[1]=1; +Fr (I,2, MAXP) { - if(!prime[i]) pri[++tot]=i,h[i]= (i-i*i%mod)%MoD; $ intj=1; $ while(J<=tot && pri[j]*i<=Maxp) { -prime[Pri[j]*i]=1; - if(i%pri[j]==0 ){ theh[pri[j]*i]=pri[j]*h[i]%MoD; - Break;Wuyi } theh[pri[j]*i]=h[pri[j]]*h[i]%MoD; -J + +; Wu } - } AboutFr (I,1, MAXP) $F[i]= (f[i-1]+h[i])%MoD; - } - - ll Sum (ll X,ll y) A { + return((x+1) *x/2%MOD) * ((y+1) *y/2%MOD)%MoD; the } - $ the ll Calc (ll X,ll y) the { the if(x>y) Swap (x, y); thell res=0, i=1, POS; - while(i<=x) { inPos=min (x/(x/i), y/(y/i)); theRes= (Res+sum (x/i,y/i) * (f[pos]-f[i-1])%mod)%MoD; thei=pos+1; About } the return(res+mod)%MoD; the } the + voidWork () - { the Get();Bayi while(t-- ){ the //cin >> n >> m; thescanf"%d%d",&n,&m); -cn1=Calc (n,m); - print (); the } the } the the intMain () - { the read (); the Work (); the write ();94 return 0; the}
Bzoj 2693 Jzptab "The inverse of the Mo"