![subject](/tpl/images/cats/informatica.png)
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)
![ansver](/tpl/images/cats/User.png)
Answers: 2
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 15:30
Brian wants to conduct an online search with a certain phrase. he intends to use the words books that belong to the 1800s in his search. how should he use the word that in his search?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 21:30
Examine the list below. which factors positively affect lifetime income? check all that apply.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 22:00
Take a critical look at three gui applications you have usedβfor example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 00:00
Visualizing a game of βtagβ to remember the meaning of contagious
Answers: 3
You know the right answer?
Uluthando needs your help to plant some trees. He can give you three parameters of the land:
- widt...
Questions
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 06.07.2019 00:00
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 06.07.2019 00:00
![question](/tpl/images/cats/en.png)
English, 06.07.2019 00:00
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/geografiya.png)
Geography, 06.07.2019 00:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
English, 06.07.2019 00:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
History, 06.07.2019 00:00
![question](/tpl/images/cats/geografiya.png)
Geography, 06.07.2019 00:00
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/health.png)
Health, 06.07.2019 00:00
![question](/tpl/images/cats/istoriya.png)
History, 06.07.2019 00:00
![question](/tpl/images/cats/istoriya.png)
History, 06.07.2019 00:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 06.07.2019 00:00
![question](/tpl/images/cats/en.png)
English, 06.07.2019 00:00