3834: [Poi2014]Solar Panels Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 367  Solved: 285[Submit][Status][Discuss] Description Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the go…
题目描述 Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the gold as within a few days  clients walked through his door. Each client has ordered a single rectangular panel with specified w…
http://www.lydsy.com/JudgeOnline/problem.php?id=3834 题意:求$max\{(i,j)\}, smin<=i<=smax, wmin<=i<=wmax$,其中$smin<=smax<=10^9, wmin<=wmax<=10^9$,有$N<=1000$组数据 #include <bits/stdc++.h> using namespace std; int main() { int cs,…
[BZOJ3834][Poi2014]Solar Panels Description Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the gold as within a few days  clients walked through his door. Each client has ordered a si…
题目描述 Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the gold as within a few days  clients walked through his door. Each client has ordered a single rectangular panel with specified w…
题意 \(T\)组数据,每次询问第\(k\)个无平方因子的数(\(1\)不算平方因子),\(T\leq 50,k\leq 10^9\) 题解 \(k\)的范围很大,枚举肯定不行,也没什么奇妙性质,于是可以想到二分. 二分的话我们需要实现一个函数\(f(n)\)表示\(n\)以内的数中无平方因子的数个数 这十分经典,相当于求\(f(n)=\sum_{i=1}^n\mu^2(i)\) 解法就是:我们考虑一个质数\(p\),\(p^2\)的倍数都不满足要求,也就是说答案得减去\(\lfloor \fr…
题目大意: $T(T\le1000)$组询问,每次给出$A,B,C,D(A,B,C,D\le10^9)$,求满足$A\le x\le B,C\le y\le D$的最大的$\gcd(x,y)$. 思路: 令$n=\gcd(x,y)$,则若$n$为合法的答案,当且仅当$\lfloor\frac{A-1}n\rfloor<\lfloor\frac Bn\rfloor,\lfloor\frac{C-1}n\rfloor<\lfloor\frac Dn\rfloor$. 考虑数论分块,每次用块内最大值…
题目链接 BZOJ3834 题解 容易想到对于\(gcd(x,y) = D\),\(d\)的倍数一定存在于两个区间中 换言之 \[\lfloor \frac{a - 1}{D} \rfloor < \lfloor \frac{b}{D} \rfloor\] \[\lfloor \frac{c - 1}{D} \rfloor < \lfloor \frac{d}{D} \rfloor\] 整除分块即可做到\(O(n\sqrt{max\{b\}})\) #include<algorithm&…
题意 询问两个区间[smin,smax],[wmin,smax]中是否存在k的倍数,使得k最大 分析 将其转化成\([\frac{smin-1}k,\frac{smax}k],[\frac{wmin-1}k,\frac{wmax}k]\) 用分块思想做,注意到这只有\(O(\sqrt{n})\)种取值,于是可以分段计算,做到\(O(\sqrt{n})\)每次询问 我的理解:每一块为[i,j],j=b/(b/i)表示该块的最右端,而i表示该块的最左端,b在[i,j]上的值b/i相同 trick 代…
问题相当于找到一个最大的k满足在$[x_1,x_2]$,$[y_1,y_2]$中都有k的倍数 等价于$\frac{x_2}{k}>\frac{x_1-1}{k}$且$\frac{y_2}{k}>\frac{y_1-1}{k}$ 注意到这只有$O(\sqrt{n})$种取值,于是可以分段计算,做到$O(\sqrt{n})$每次询问 #include<cstdio> int T,a,b,c,d,i,j,t; inline void up(int&a,int b){if(a>…