Title: There are three families ABC clean up a garden, each home cleans up the same speed, C family goes on vacation, only AB two home cleaning;
A home cleanup x hours, b home cleanup y hours, C family came back to pay the Z-dollar, ask a family how much money to get.
Analysis: Simple questions. Take a look at the sample, divide the garden into 3 parts, a total of 9 hours to clean up, each family's first 3 hours is their own;
So, a family cleaned up the C family part for 2 hours, and the B family cleaned up the C family part for 1 hours, so a family got $60.
The total is set at 3a hours, and C family Part B works for b hours, then the following equation:
Then set (2a-b)/(a+b) = k = x/Y (A-B)/a = (2k-1)/(k+1) = (2m-n)/(N+M).
Description: Rushed to the top 600 (⊙o⊙).
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include < Cstdio> #include <cmath>using namespace Std;int main () {int n,x,y,z;while (~scanf ("%d", &n)) for (int i = 0; i < n; + + i) {scanf ("%d%d%d", &x,&y,&z);p rintf ("%d\n", z* (2*x-y)/(X+y));} return 0;}
UVa 12502-three Families