Files
python/TangDou/CSP-J/J2_2020/ZhuanTi_BiaoDaShi/Tree/TD.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
615 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, d, x, e, y;
cin >> a >> b >> c >> d >> x >> e >> y;
for (int i = 1; i <= 500; i++)
for (int j = 1; j <= 500; j++)
for (int k = 1; k <= 500; k++)
if (i + j * b == a * k * b && i + j * d == c * k * d) {
for (int u = 1; u <= 500; u++)
if (u * x * k + (u - e) * y * k == (x + y) * j + i) {
cout << u << endl;
exit(0);
}
}
return 0;
}