2286. Ecological Agriculture

单点时限: 2.0 sec

内存限制: 256 MB

Stirred up by the BSE - scandal, Germany may push ecological agriculture in the near future. Exact calculations are needed to plan a reasonable strategy and you are given the task to write a computer program that carries out these calculations.

German farmers are given a premium depending on the conditions at their farmyard. Imagine the following simplified regulation: you know the size of each farmer’s farmyard in square metres and the number of animals living at it. We won’t make a difference between different animals, although this is far from reality. Moreover you have information about the degree the farmer uses environment-friendly equipment and practicies, expressed in a single integer greater than zero. The amount of money a farmer receives can be calculated from these parameters as follows. First you need the space a single animal occupies at an average. This value (in squaremetres) is then multiplied by the parameter that stands for the farmer’s environment-friendlyness, resulting in the premium a farmer is payed per animal he owns. To compute the final premium of a farmer just multiply this premium per animal with the number of animals the farmer owns.


The first line of input contains a single integer n, the number of test cases. Each test case starts with a line containing a single integer f, the number of farmers in the test case. This line is followed by one line per farmer containing three integers each: the size of the farmyard in squaremetres, the number of animals he owns and the integer value that expresses the farmers environment-friendlyness.


For each test case output one line containing a single integer that holds the summed burden for Germany’s budget, which will always be a whole number. Do not output any blank lines.


1 1 1
2 2 2
3 3 3
2 3 4
8 9 2
9 1 8
6 12 1
8 1 1
10 30 40
9 8 5
100 1000 70

6 人解决,8 人已尝试。

6 份提交通过,共有 9 份提交。

6.3 EMB 奖励。

创建: 14 年,6 月前.

修改: 5 年,5 月前.

最后提交: 2 年,2 月前.

来源: Freshman Programming Contest