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. When you figured out why, answer the following question: If family A and B spent x and y hours respectively, and family C paid $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 (   T100), the number of test cases. Each test case contains three integers x,    y,    z (   1x,    y10,    1z1000).

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

题目大意:水题,不解释。推出计算公式瞬秒!
 #include<iostream>
#include<cstdio>
using namespace std;
int main(){
int T;cin>>T;
while(T--){
int x,y,z;
cin>>x>>y>>z;
cout<<(*x*z)/(x+y)-z<<'\n';
}return ;
}
												

[ACM_水题] UVA 12502 Three Families [2人干3人的活后分钱,水]的更多相关文章

  1. [ACM_水题] UVA 11729 Commando War [不可同时交代任务 可同时执行 最短完成全部时间 贪心]

    There is a war and it doesn't look very promising for your country. Now it's time to act. You have a ...

  2. [ACM_水题] UVA 11292 Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]

    Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shor ...

  3. URAL 1136 Parliament 二叉树水题 BST后序遍历建树

    二叉树水题,特别是昨天刚做完二叉树用中序后序建树,现在来做这个很快的. 跟昨天那题差不多,BST后序遍历的特型,找到最后那个数就是根,向前找,比它小的那块就是他的左儿子,比它大的那块就是右儿子,然后递 ...

  4. NOIP水题测试(2017082401)

    哈,水题测试又来了! 上次的水题简单吧! 答案是以单题形式发布的(旅行家的预算随后发布). 下面来看今天的题,还是水题. 时间限制:5小时 题目一:看上去就很水 题目二:比上面一题还水 题目三:数的划 ...

  5. poj 1658 Eva's Problem(水题)

    一.Description Eva的家庭作业里有很多数列填空练习.填空练习的要求是:已知数列的前四项,填出第五项.因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习. Inpu ...

  6. #82. 【UR #7】水题生成器

    链接:http://uoj.ac/problem/82 今天是世界水日,著名的水题资源专家蝈蝈大臣向世界宣布了他的一项新发明 —— 水题生成器. 每道题目都有一个正整数的难度值.水题生成器虽然强大但是 ...

  7. UVa 489 HangmanJudge --- 水题

    UVa 489 题目大意:计算机给定一个单词让你猜,你猜一个字母,若单词中存在你猜测的字母,则会显示出来,否则算出错, 你最多只能出错7次(第6次错还能继续猜,第7次错就算你失败),另注意猜一个已经猜 ...

  8. UVa 1339 Ancient Cipher --- 水题

    UVa 1339 题目大意:给定两个长度相同且不超过100个字符的字符串,判断能否把其中一个字符串重排后,然后对26个字母一一做一个映射,使得两个字符串相同 解题思路:字母可以重排,那么次序便不重要, ...

  9. UVa 1225 Digit Counting --- 水题

    UVa 1225 题目大意:把前n(n<=10000)个整数顺次写在一起,12345678910111213...,数一数0-9各出现多少字 解题思路:用一个cnt数组记录0-9这10个数字出现 ...

随机推荐

  1. java链接FTP实现上传和下载

    FtpUtil.java import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStr ...

  2. all any some

    SQLServer中有三个关键字可以修改比较运算符:All.Any和Some,其中Some和Any等价. 他们作用于比较运算符和子查询之间,作用类似Exists.not exists.in.not i ...

  3. Quartz入门

    Quartz体系结构: 明白Quartz怎么用,首先要了解Scheduler(调度器).Job(任务)和Trigger(触发器)这3个核心的概念.请注意加粗内容. 1. Job: 是一个接口,只定义一 ...

  4. 使用python识别验证码

    公司的登录注册等操作有验证码,测试环境可以让开发屏蔽掉验证码,但是如果到线上的话就要想办法识别验证码或必过验证码了. 识别验证码主要分为三部分,一.对验证码进行二值化.二.将二值化后的图片分割.三.进 ...

  5. poj1088-滑雪 【dfs 记忆化搜索】

    http://poj.org/problem?id=1088 滑雪 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 79806 ...

  6. 33. Search in Rotated Sorted Array旋转数组二分法查询

    一句话思路:反正只是寻找一个最小区间,断开也能二分.根据m第一次的落点,来分情况讨论. 一刷报错: 结构上有根本性错误:应该是while里面包括if,不然会把代码重复写两遍,不好. //situati ...

  7. ContentProvider-------------自定义的内容提供者 然后去访问

    自定义提供者 import android.content.Context; import android.database.DatabaseErrorHandler; import android. ...

  8. 20172325 2017-2018-2 《Java程序设计》第十周学习总结

    20172325 2017-2018-2 <Java程序设计>第十周学习总结 教材学习内容总结 1.集合与数据结构 集合是一种对象 集合按照保存类型来看可以分为两种: (1)同构集合:只能 ...

  9. codevs1246 丑数

    题目描述 Description 对于一给定的素数集合 S = {p1, p2, ..., pK}, 来考虑那些质因数全部属于S 的数的集合.这个集合包括,p1, p1p2, p1p1, 和 p1p2 ...

  10. Netty 零拷贝(三)Netty 对零拷贝的改进

    Netty 零拷贝(三)Netty 对零拷贝的改进 Netty 系列目录 (https://www.cnblogs.com/binarylei/p/10117436.html) Netty 的&quo ...