mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 14:36:27 +00:00
P3579 [POI2014]PAN-Solar Panels
https://www.luogu.com.cn/record/89548822
This commit is contained in:
parent
b2b875c0eb
commit
059ef4d859
27
Luogu/P3579/P3579.cpp
Normal file
27
Luogu/P3579/P3579.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
int n, a, b, c, d, ans;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
while (n--) {
|
||||||
|
cin >> a >> b >> c >> d;
|
||||||
|
|
||||||
|
for (int i = 1, j; i <= std::min(b, d); i = j + 1) {
|
||||||
|
j = std::min(b / (b / i), d / (d / i));
|
||||||
|
if (b / j * j >= a && d / j * j >= c) ans = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ans << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user