Portal Description 进行\(T(T\leq10^5)\)次询问,每次给出\(x_1,x_2,y_1,y_2\)和\(d\)(均不超过\(10^5\)),求\(\sum_{i=x_1}^{x_2} \sum_{j=y_1}^{y_2} [gcd(i,j)=d]\). Solution 莫比乌斯反演入门题. 设\(calc(n,m)\)表示\(i\in[1,n],j\in[1,m]\)且\(gcd(i,j)=d\)的数对\((i,j)\)的个数.那么简单地进行容斥,可知\(ans=…