Computers and Technology, 02.03.2021 14:00 dominickstrickland
Uluthando needs your help to plant some trees. He can give you three parameters of the land:
- width of the land w
- length of the land l
- gap between the trees g
You have to create an algorithm to return the number of trees which can be planted on the edges of the given land in a symmetrical layout shown below (unsymmetrical gap = x, tree = o, gap = -):
w=3, l=3, g=1
plantTrees(w, l, g) ā 4
o - o
- -
o - o
// Uluthando can plant 4 trees.
w=3, l=3, g=3
plantTrees(w, l, g) ā 2
o - -
- -
- - o
// Uluthando can plant 2 trees.
If the layout is not symmetrical, you have to return 0:
w=3, l=3, g=2
plantTrees(w, l, g) ā 0
o - -
x o
x x x
// Planting 2 trees mean the gap of two trees will be greater than 2.
o - -
x o
o - -
// Planting 3 trees mean the gap of two trees will be less than 2.
Another Example for better understanding:
w=3, l=3, g=0
plantTrees(w, l, g) ā 8
o o o
o o
o o o
// Uluthando can plant 8 trees.
(10 Points)
Answers: 2
Computers and Technology, 22.06.2019 09:00
Which best describes the condition under which the unicode output is the same as plain text?
Answers: 3
Computers and Technology, 23.06.2019 01:30
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
Computers and Technology, 23.06.2019 12:30
What is the difference between the internet and the world wide web?
Answers: 1
Computers and Technology, 23.06.2019 16:10
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
Uluthando needs your help to plant some trees. He can give you three parameters of the land:
- widt...
Social Studies, 09.12.2020 22:40
Social Studies, 09.12.2020 22:40
Mathematics, 09.12.2020 22:40
Mathematics, 09.12.2020 22:40
Chemistry, 09.12.2020 22:40
English, 09.12.2020 22:40
Mathematics, 09.12.2020 22:40
Mathematics, 09.12.2020 22:40