Algorithm

Problem Name: 2 AD-HOC - beecrowd | 1765

Christmas Trapeziums

By Lucas Campesatto, beecrowd Brazil

Timelimit: 1

Jorge was a very determined guy to create sweet Christmas trapezoids. The trapezoids are made of yarn candy toffee and filled with ice cream. Baked after they assume a perfect two-dimensional shape of a trapezium. By default, all trapezoids have the same height, 5cm, and their bases can change size depending on the availability of taffy that Jorge has in inventory. Some day Jorge was curious to know how much ice cream was using for each trapezoid size that he did, so he called you to help him.

You should make a program that given the different sizes of trapezoids that will be made, how many trapezoids that size will be produced and measurements of the bases of toffee, you tell how many cm2 of ice cream will be used for each size.

Input

The input consists of several test cases. The first line of each test case begins with an integer T (0 ≤ T ≤ 50) indicating how many different sizes will be in that batch. The following T lines contain 3 values, an integer Q (0 ≤ Q ≤ 50) indicating the amount of trapezoids made with the measures A and B (0 ≤ A, B ≤ 50) both double precision preceded by Q. The input ends when T is zero.

Output

For each test case present the value of ice cream used, in cm2 for each size. After each test case, print a blank line.

 Input Sample Output Sample 3 3 4.5 5.6 7 2.0 9.5 22 35.8 9.3 5 4 15.8 14.9 22 25.7 13.8 29 2.9 30.5 10 1.5 15.6 17 34.7 15.9 0 Size #1: Ice Cream Used: 75.75 cm2 Size #2: Ice Cream Used: 201.25 cm2 Size #3: Ice Cream Used: 2480.50 cm2 Size #1: Ice Cream Used: 307.00 cm2 Size #2: Ice Cream Used: 2172.50 cm2 Size #3: Ice Cream Used: 2421.50 cm2 Size #4: Ice Cream Used: 427.50 cm2 Size #5: Ice Cream Used: 2150.50 cm2

Code Examples

#1 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include <iostream>
#include <cstdio>

#define HIGH 5

using namespace std;
int main ()
{
int qtde;
int T;
double b;
double B;
int size;

while (1)
{
cin >> T;
if (!T) break;
size = 1;
while (T--)
{
cin >> qtde;
cin >> b >> B;
printf("Size #%d:\nIce Cream Used: %.2lf cm2\n",size, ((double)qtde * ((b+B)*HIGH)/2));
size++;
}
cout << '\n';
}
}
``````
Copy The Code &

Input

cmd
3
3 4.5 5.6
7 2.0 9.5
22 35.8 9.3
5
4 15.8 14.9
22 25.7 13.8
29 2.9 30.5
10 1.5 15.6
17 34.7 15.9
0

Output

cmd
Size #1:
Ice Cream Used: 75.75 cm2
Size #2:
Ice Cream Used: 201.25 cm2
Size #3:
Ice Cream Used: 2480.50 cm2
Size #1:
Ice Cream Used: 307.00 cm2
Size #2:
Ice Cream Used: 2172.50 cm2
Size #3:
Ice Cream Used: 2421.50 cm2
Size #4:
Ice Cream Used: 427.50 cm2
Size #5:
Ice Cream Used: 2150.50 cm2