Computer Science, asked by KesavanCSE, 1 month ago

Single File Programming Question The Wonderland consists of N cities and they are connected by N-1 bidirectional road in such a manner that you can travel from one city to another city in exactly one path. In other words, the map looks like a tree. The cities are numbered from 1 to N. There are a large number of mongooses in Iceland King Cobra has decided that he wants to eliminate the mongooses, and is hence preparing to wage a war. The snakes have recently procured aeroplanes, and thus they can parachute their soldiers onto some of the Iceland cities. Suppose on Day 0, these soldiers are parachuted. You know that to capture City i, you need to parachute in P₁ soldiers. By end of Day 0, they would have captured their respective cities. Each city depends on its neighbours for some of its supplies, and so, if a certain number of its neighbours are captured, then this city will fall as well. In particular, for every City i, you know that if City i was uncaptured on Day d, and at least C; of its neighbours are captured on Day d, then this city will be captured on Day d+1, where d≥0. A city that has been captured will forever remain captured. King Cobra doesn't mind waiting for however long it takes to capture the entire Mongoose kingdom, but he wants to do it with the least number of soldiers. Help him find the least number of soldiers he should send so that the entire Mongoose kingdom can be captured eventually. Formally, you need to find a subset of cities, S, such that the sum of P; over these cities is minimized, and the entire kingdom will be captured eventually if soldiers are parachuted into exactly these cities. You need to output this minimum s​

Answers

Answered by RithwikAnantha
0

ANSWER

:

So now you enter the second stage of development (in reality it's the fourth or fifth, but you'll come to the earlier stages later): Testing and .

Start by looking at what it does do, and how that differs from what you wanted. This is important, because it give you information as to why it's doing it. For example, if a program is intended to let the user enter a number and it doubles it and prints the answer, then if the input / output was like this:

!

Explanation:

PLEASE MARK AS BRAINLIEST ANSWER EZ

Similar questions