#t1145. 矩形的面积与周长

矩形的面积与周长

Area and Perimeter of a Rectangle

Problem Description

The first lesson on structs: define a struct, access its members.

A struct packs several related values into a single object. Define a struct that represents a rectangle:

struct Rectangle {
    int a;  // length
    int b;  // width
};

Read the length and width of nn rectangles into struct variables, then print each rectangle's area (a×ba \times b) and perimeter (2(a+b)2(a+b)). Access the members with .a and .b.

Input Format

The first line contains a positive integer nn; the next nn lines each contain two integers a,ba, b, the length and width of one rectangle.

Output Format

nn lines; line ii holds the area and the perimeter of the ii-th rectangle, separated by a space.

Sample Input

2
2 3
5 1

Sample Output

6 10
5 12

Constraints

For 100% of the test data, 1≤n≤1001 \le n \le 100 and 1≤a,b≤10001 \le a, b \le 1000.

Hint: this problem tests defining a struct and accessing its members — really define the struct, do not dodge it.