Problem Statement
You are tasked with writing a method which accepts 3 arguments: an
Definition
- Class:
- TVSize
- Method:
- calcSize
- Parameters:
- int, int, int
- Returns:
- int[]
- Method signature:
- int[] calcSize(int diagonal, int height, int width)
- (be sure your method is public)
Notes
- Let W denote the width, H denote the height and D denote the diagonal of the screen. Then W*W + H*H = D*D and W * height = H * width.
Constraints
- diagonal will be between 5 and 1000, inclusive.
- height will be between 1 and 99, inclusive.
- width will be between 2 and 100, inclusive.
- width will be greater than height.
Examples
52
9
16
Returns: {25, 45 }
W = (width/height) * H D*D = W*W + H*H 52^2 = (width/height)^2 * H^2 + H^2 52^2 = (16/9)^2 * H^2 + H^2 H = 25.49 W = 45.32
7
2
3
Returns: {3, 5 }
13
7
10
Returns: {7, 10 }
7
32
47
Returns: {3, 5 }
11
15
16
Returns: {7, 8 }
103
9
16
Returns: {50, 89 }
36
3
4
Returns: {21, 28 }
1000
99
100
Returns: {703, 710 }
22
1
2
Returns: {9, 19 }
23
34
35
Returns: {16, 16 }
256
99
100
Returns: {180, 181 }
17
1
2
Returns: {7, 15 }
888
8
100
Returns: {70, 885 }
231
1
100
Returns: {2, 230 }
100
99
100
Returns: {70, 71 }
5
99
100
Returns: {3, 3 }
1000
1
2
Returns: {447, 894 }
500
50
51
Returns: {350, 357 }
666
3
5
Returns: {342, 571 }
10
5
8
Returns: {5, 8 }
83
22
87
Returns: {20, 80 }
775
63
80
Returns: {479, 608 }
169
13
26
Returns: {75, 151 }
144
1
4
Returns: {34, 139 }
211
43
47
Returns: {142, 155 }
818
69
96
Returns: {477, 664 }
513
11
12
Returns: {346, 378 }
967
96
97
Returns: {680, 687 }
333
30
37
Returns: {209, 258 }
97
2
99
Returns: {1, 96 }
101
10
100
Returns: {10, 100 }
5
1
2
Returns: {2, 4 }
5
3
4
Returns: {3, 4 }
1000
99
100
Returns: {703, 710 }
377
25
60
Returns: {145, 348 }
291
65
72
Returns: {195, 216 }
679
65
72
Returns: {455, 504 }