Легко Решено: 0 Процент решений: 0%

Rectangle Perimeter

Compute the perimeter of a rectangle from its sides.

Условие

A rectangle has two sides of length width and two sides of length height. Its perimeter is the total length of all four sides.

Implement rectangle_perimeter(width, height).

Input

width: The width of the rectangle. height: The height of the rectangle.

Output

Return the perimeter as an integer.

Ограничения

1 ≤ width, height ≤ 1,000,000

Примеры

Пример 1
Ввод:
width = 3
height = 5

Ожидаемый вывод:
expected = 16
Ввод:
long long width = 3;
long long height = 5;

Ожидаемый вывод:
long long expected = 16;
Ввод:
long width = 3;
long height = 5;

Ожидаемый вывод:
long expected = 16;

Пояснение

Two sides of 3 and two sides of 5: 3 + 3 + 5 + 5 = 16.

Пример 2
Ввод:
width = 7
height = 7

Ожидаемый вывод:
expected = 28
Ввод:
long long width = 7;
long long height = 7;

Ожидаемый вывод:
long long expected = 28;
Ввод:
long width = 7;
long height = 7;

Ожидаемый вывод:
long expected = 28;

Пояснение

A square is a rectangle too: 4 × 7 = 28.

Ссылки

Это задание адаптировано для CodeUtility. Следуйте условию и ограничениям выше.

Учитесь у других

Решения сообщества

Пока нет опубликованных решений. Решите задание, чтобы поделиться первым.