[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 = 50? No no no. Think hard. The correct answer is  60. W h e n y o u f i g u r e d o u t w h y , a n s w e r t h e f o l l o w i n g q u e s t i o n : I f f a m i l y A a n d B s p e n t x a n d y h o u r s r e s p e c t i v e l y , a n d f a m i l y C p a i d z, 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 }
复制代码
相关文章
|
6月前
|
Java 测试技术
HDU-1233-还是畅通工程
HDU-1233-还是畅通工程
38 0
hdu 2502 月之数
hdu 2502 月之数
30 0
畅通工程 HDU - 1232
畅通工程 HDU - 1232
79 0
|
人工智能 BI 网络架构
[计蒜客] ACM-ICPC 2018 南京赛区网络预赛 | 部分题解 | 线段树 + 线性筛 + 最短路(上)
E. AC Challenge 题目描述 输入 输出 样例输入 样例输出 提示 题意: A. An Olympian Math Problem G. Lpl and Energy-saving Lamps 题目描述 输入 输出 样例输入 样例输出 提示 ac_code:
167 0
[计蒜客] ACM-ICPC 2018 南京赛区网络预赛 | 部分题解 | 线段树 + 线性筛 + 最短路(上)
|
机器学习/深度学习 Go
[计蒜客] ACM-ICPC 2019 南京赛区网络预赛 | 部分题解 | 线段树 + 线性筛 + 最短路(下)
J. Nanjing Sum 题目描述 输入 输出 样例输入 样例输出 提示 L. Magical Girl Haze 题目描述 输入 输出 样例输入 样例输出 题意:
153 0
[计蒜客] ACM-ICPC 2019 南京赛区网络预赛 | 部分题解 | 线段树 + 线性筛 + 最短路(下)
|
算法
HDU - 2063: 过山车
HDU - 2063: 过山车
143 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 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。
1022 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个大富翁.
1096 0