mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 19:08:47 +00:00
parent
b94989caf0
commit
6c342c8e5f
54
S2OJ/1685/1685.cpp
Normal file
54
S2OJ/1685/1685.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
std::pair<int, int> calc(int n, int b, int x) {
|
||||
int k = std::ceil(1.0 * x / b);
|
||||
return {n - k, x - k * b};
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int t;
|
||||
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
int n, m, a, b;
|
||||
|
||||
cin >> n >> m >> a >> b;
|
||||
|
||||
int s = b, t = a;
|
||||
|
||||
while (n && m) {
|
||||
int k = std::min(
|
||||
std::ceil(static_cast<double>(s) / m),
|
||||
std::ceil(static_cast<double>(t) / n));
|
||||
int x = k * n, y = k * m;
|
||||
|
||||
while (m && x >= t) {
|
||||
x -= t;
|
||||
t = a;
|
||||
m--;
|
||||
}
|
||||
|
||||
while (n && y >= s) {
|
||||
y -= s;
|
||||
s = b;
|
||||
n--;
|
||||
}
|
||||
|
||||
t -= x;
|
||||
s -= y;
|
||||
}
|
||||
|
||||
cout << n << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1685/data/ex_tank1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/ex_tank1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/ex_tank1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/ex_tank1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/ex_tank2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/ex_tank2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/ex_tank2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/ex_tank2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank20.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank21.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank21.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank22.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank22.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank23.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank23.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank24.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank24.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank25.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank25.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank26.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank26.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank27.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank27.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank28.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank28.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank29.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank29.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank30.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank30.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank31.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank31.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank32.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank32.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank33.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank33.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank33.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank34.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank34.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank34.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank35.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank35.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank35.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank36.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank36.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank36.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank37.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank37.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank37.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank38.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank38.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank38.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank39.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank39.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank39.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank40.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank40.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank40.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1685/data/tank9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1685/data/tank9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user