UVa 12502 Three Families:想法题2014-07-07 synapse7 http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3946哈哈。考想法的一道题。首先注意到这句话:You may assume both families were cleaning at the same speed.所以按理来说,(样例1中)本应该周末每个家庭都花3小时来清理花园,但A在忙完自己的一部分后又帮了C2小时,B帮了C1小时所以A要得90*2/(2+1)=60美刀完整代码:
/*0.019s*/#include<cstdio>int main(){int t, a, b, m;scanf("%d", &t);while (t--){scanf("%d%d%d", &a, &b, &m);printf("%d
", m * (2 * a - b) / (a + b));}return 0;}