8000 Update README.md · TopWork0ut/C-Cpp-algorithms@0259b8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 0259b8e

Browse files
authored
Update README.md
1 parent b9f8b2a commit 0259b8e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ You order the electric wire for connecting the poles from China, and it will tak
88

99
(In other words - you need to find such a sequence of pole heights that the wire connecting their tops will be the longest)
1010

11-
##Input data:
11+
## Input data:
1212

1313
The first line contains w - the distance between the pillars. The second line contains N numbers describing the maximum possible height for each pillar (i.e. an array of heights).
1414

15-
##Output:
15+
## Output:
1616

1717
The maximum possible required length of the wire with 2 digits after the decimal point.
1818

19-
##Constraints:
19+
## Constraints:
2020

2121
w, heights[i] - integers in the range 1 ... 100
2222
N < 50
2323

2424
Of course, you must ignore various physical constraints ala wire sagging or wire consumption per connection
2525

26-
###Examples:
26+
### Examples:
2727
In:
2828
2
2929
3 3 3
@@ -52,7 +52,7 @@ In:
5252
Out:
5353
2738.18
5454

55-
##Solution
55+
## Solution
5656

5757
The greatest height will be when the hypotenuse of the square triangle (the distance between the vertices of the pillars) is the greatest. This can be done if one of the adjacent pillars is set to height 1, and the other is left with the same height. But we need to consider two cases. The first is when height 1 is for even numbers of posts, 2 for odd numbers. Of course, when the array starts with 1, we will take only for odd numbers.
5858

0 commit comments

Comments
 (0)
0