#C2701. Calculate Card Perimeters
Calculate Card Perimeters
Calculate Card Perimeters
You are given several queries, each representing the dimensions of a rectangular card. For each query, you need to compute the perimeter of the card using the formula:
$$ P = 2 \times (w + h) $$
where w is the width and h is the height of the card.
The input starts with an integer T
representing the number of queries. Then, T
lines follow, each line containing two space-separated integers indicating the width and height of a card. For each query, output the computed perimeter on a new line.
This is a simple problem intended to test your ability to perform basic arithmetic operations and handle multiple test cases.
inputFormat
The first line of input contains a single integer T
(1 ≤ T ≤ 104) denoting the number of queries. Each of the next T
lines contains two space-separated integers w
and h
(1 ≤ w, h ≤ 104) representing the width and height of a card.
outputFormat
For each query, output the perimeter of the card on a separate line. The perimeter is calculated using the formula: $$ P = 2 \times (w + h) $$## sample
1
4 5
18
</p>