[ACM_水题] UVA 12502 Three Families [2人干3人的活后分钱,水]

简介:


 

 

  Three Families 

Three families share a garden. They usually clean the garden together at the end of each week, but last week, family C was on holiday, so family A spent 5 hours, family B spent 4 hours and had everything done. After coming back, family C is willing to pay $90 to the other two families. How much should family A get? You may assume both families were cleaning at the same speed.

90/(5+4)5=90/(5+4)∗5=50? No no no. Think hard. The correct answer is 60.Whenyoufiguredoutwhy,answerthefollowingquestion:IffamilyAandBspentxandyhoursrespectively,andfamilyCpaid60.Whenyoufiguredoutwhy,answerthefollowingquestion:IffamilyAandBspentxandyhoursrespectively,andfamilyCpaidz, how much should family A get? It is guaranteed that both families should get non-negative integer dollars.

 

WARNING: Try to avoid floating-point numbers. If you really need to, be careful!

 

Input 

The first line contains an integer T (   T$ \le$100), the number of test cases. Each test case contains three integers x,    y,    z (   1$ \le$x,    y$ \le$10,    1$ \le$z$ \le$1000).   

 

Output 

For each test case, print an integer, representing the amount of dollars that family A should get.   

 

Sample Input 

 

2
5 4 90
8 4 123

 

Sample Output 

 

60
123

题目大意:水题,不解释。推出计算公式瞬秒!
复制代码
 1 #include<iostream>
 2 #include<cstdio>
 3 using namespace std;
 4 int main(){
 5     int T;cin>>T;
 6     while(T--){
 7         int x,y,z;
 8         cin>>x>>y>>z;
 9         cout<<(3*x*z)/(x+y)-z<<'\n';
10     }return 0;
11 }
复制代码


相关文章
|
1月前
|
Java 测试技术
HDU-1233-还是畅通工程
HDU-1233-还是畅通工程
18 0
|
7月前
hdu 2502 月之数
hdu 2502 月之数
19 0
|
11月前
|
测试技术 C++
【PTA天梯赛】L1-001 L1-002 L1-003 L-004 L-005 L-006 L-007 L-008 L-009 L1-010 c++
【PTA天梯赛】L1-001 L1-002 L1-003 L-004 L-005 L-006 L-007 L-008 L-009 L1-010 c++
186 1
|
11月前
|
C++
【PTA天梯赛】L1-011 —— L1-020 c++ 题解
【PTA天梯赛】L1-011 —— L1-020 c++ 题解
290 0
畅通工程 HDU - 1232
畅通工程 HDU - 1232
61 0
|
算法
HDU - 2063: 过山车
HDU - 2063: 过山车
116 0
|
Java 测试技术
HDU 1232 畅通工程
畅通工程 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 50540    Accepted Submission(s): 26968 Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。
1005 0
|
人工智能 Java C++
HDU 3785 寻找大富翁
寻找大富翁 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6716    Accepted Submission(s): 2492 Problem Description 浙江桐乡乌镇共有n个人,请找出该镇上的前m个大富翁.
1050 0
|
人工智能 算法 Java