You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
936 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
}