Files
python/TangDou/XiTi/1423.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

33 lines
936 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
/**
维尼熊和跳跳虎去摘苹果.维尼熊爬上树去摘,跳跳虎在地上跳着摘.
跳跳虎每摘x个,维尼熊只能摘y个
维尼熊摘了a分钟跳跳虎摘了b分钟就累了
不摘了他们回来后数了一下共摘z个苹果那么其中维尼熊摘的有?个.
根据分析跳跳虎和维尼熊每分钟摘的苹果数之比为x:y而摘的时间之比为b:a
故摘的苹果总数之比为x*b:y*a
维尼熊摘的苹果数是: z * (y*a)/(x*b+y*a)
测试用例:
7 4 80 50 2010
v熊 * x/y = v虎
80 v熊 + 50 v虎 =2010
80 v熊 + 50 v熊 x/y=2010
80 v熊 + 50 v熊 * 7 /4=2010
80a+50×a÷4×7=2010
80a+87.5a=2010
167.5a=2010
a=12
维尼熊摘了=12×80=960个
*/
int main() {
int x, y, a, b, z;
cin >> x >> y >> a >> b >> z;
cout << z * (a * y) / (a * y + x * b) << endl;
return 0;
}