Main topic:Take a number from 1~b as x, and a number in the 1~d as YHow many kinds of gcd (x, y) = k are madeHere we can use the Möbius function to solve the problem.The formula used here is [gcd (x, y) ==1] =σ (DEL|GCD (x, y)) Mu (del)Σ (1=σ (1=σ (1=σ (11#include 2#include 3#include 4 5 using namespacestd;6 #definell Long Long7 #defineN 1000108 intMu[n], prime[n];9 BOOLCheck[n];Ten One voidGETMU (intN) A { -memset (check,0,sizeof(check)); -mu[1] =1; the inttot =0; - for(intI=2; I){ -
Everything starts hard.When I was in college, I thought I was a literary teenager, writing a song and writing a diary. After work seems to have not written, and now want to write a few words need to grasp the heart scratching the cheek, this log is basically finished.First introduce oneself, my name Ringling, is a male program ape, Liaoning Dalian people, so far single. In 13 after graduating from Shenyang to work so far, there are now to go to the North wide-depth of the plan, want to engage in
The main topic: Beg Σ[i|n]i^dOnlookers: http://www.cnblogs.com/jianglangcaijin/p/4033399.htmlSure enough, I'm still too konjac--In addition, the 0 items of σ[1#include Bzoj 36,011 person's number theory of the Mo-de-si inverse + Gaussian elimination
: gives A,b,c,d,k, which makes a1 Set F (k) for gcd (x, y) =k number pairs (x, y) logarithm, we require f (1)2 set F (k) is gcd (x, y) is a multiple of the number of K (x, y) logarithm, can think of f (k) = Floor (b/k) *floor (d/k), F (k) =e[b/k]*[d/k]*mu[k];3 the Möbius was reversed by: 4 Order lim=min (b/k,d/k)5 F (1) =mu[1]*f (1) + mu[2 ]*f[2] + ... + mu[lim]*F (Lim)6 because (N1,N2) and (N2,N1) are counted in the same situation, the final result is also to reduce the duplication of the s
Mo mingtao received a remittance order... the name is Beijing mingtai ruike Technology Co., Ltd., dizzy at a time ??
I don't have any money except anti-DDoS .......... I checked it online to find out that it was the charges for the hacker file .... I forgot when I sent the manuscript. Unexpected Charge Received
Surprise, take GF out for a violent meal ............
This is a non-technical article. It may be a bit difficult for a friend who works in an
nThe complexity is probably O (n*sqrt (n) *log2 (n)), but can be violent to raise points, and then back to the statistics, then O (1) answer, but N is no longer able to solve the big, even if the n#include HDU 5273 Dylans loves sequence (interval inverse logarithm-mo team algorithm)
The Great God:http://blog.csdn.net/u014800748/article/details/47680899The sum of GCDTime limit:2000/1000 MS (java/others) Memory limit:65536/65536 K (java/others)Total submission (s): 526 Accepted Submission (s): 226Problem Descriptionyou has an arrayThe length ofIsLetInputthere is multiple test cases. The first line of input contains an integer T, indicating the number of the test cases. For each test case:First line have one integersSecond Line hasIntegersThird line have one integersThe numb
right. As the example isGCD (*3*3+GCD) *3*3 + gcd (1,4) *3*3) ...........How to calculate the corresponding interval number of each GCD?It is possible to know that the GCD from the dividing line to both sides is decremented. Assuming that G is the gcd of [L,r], then for [L-1,r] only gcd (g,num[l-1]) is calculated.Then the GCD hypothesis is the same as that of G. Otherwise, a new value is added.Analysis of Complexity:For each paragraph, the total GCD and the number of O (n) are calculated.The lo
Tables bzoj-3529 Sdoi-2014 The number of n*m is the sum of all the natural numbers that divide I and J at the same time. Given a, all the and of the tables not exceeding a are calculated.Note : $1\le n,m \le 10^5$.idea : Let's not consider the limitation of that a: we set F (i) to mean the sum of the natural numbers that divide I.$\sum\limits_{i=1}^n\sum\limits_{j=1}^m f (gcd (I,J)) $$\sum\limits_{i=1}^n\sum\limits_{j=1}^m F (d) \cdot [gcd (I,J) ==d]$$\sum\limits_{d=1}^n F (d) \sum\limits_{i=1}^
Orz POPOQQQ.Originally Konjac Konjac thought that this discretization after the corresponding problem can not be the right value of the sub-block said....... As a result, >n's weight does not actually contribute to the answer.#include "Mo Team Algorithm" "Weights chunked" bzoj3585 Mex
); - intI=l,j=mid+1; - while(jR) - { A while(ip[j].b) + { the Updata (P[I].C,P[I].S); -i++; $ } thep[j].ans+=query (P[J].C); theJ + +; the } the for(intj=l;j//only until I -Updata (p[j].c,-p[j].s); in } the intMain () the { About intN=read (); m=read (); the for(intI=1; i) theA[i].a=read (), A[i].b=read (), a[i].c=read (); theSort (A +1, a+n+1, CMP1); + intCnt=0; - for(intI=1; i) the {Bayicnt++; the if(a[i].a!=a[i+1].a|
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.