-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
duct_tape.cpp
39 lines (29 loc) · 874 Bytes
/
duct_tape.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <cmath>
int get_area(int height, int width)
{
return height * width;
}
int to_inches(int feet)
{
return feet * 12;
}
int getDuctTapesNeeded(int height, int width)
{
// Everything is calculated in inches
int duct_tape_height = 720;
int duct_tape_width = 2;
int door_area_both_sides = get_area(height, width) * 2;
int duct_tape_area = get_area(duct_tape_height, duct_tape_width);
int duct_tapes_needed = ceil((double) door_area_both_sides / duct_tape_area);
return duct_tapes_needed;
}
int main()
{
int door_height_feet, door_width_feet;
std::cin >> door_height_feet >> door_width_feet;
int door_height_inches = to_inches(door_height_feet);
int door_width_inches = to_inches(door_width_feet);
std::cout << getDuctTapesNeeded(door_height_inches, door_width_inches);
return 0;
}