Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use C programming to answer the Plants vs. Zombie question please. People willing to respond to comments are encouraged to answer. Thanks! 4. Plants VS
Use C programming to answer the Plants vs. Zombie question please. People willing to respond to comments are encouraged to answer. Thanks!
4. Plants VS Zombies Plants VS Zombies is a popular game in School of Engineering and Applied Shits (SEAS). However, Vincent is not very good at this game, so he wants you to write a program to help him We take a simplified version of this game. he are N rows in your backyard, and N zombies walking through your yard trying to eat your brain (one zombie at each row exactly). The only way to defend the zombies is to plant "peashooter on the other side of the yard. However, yoru need T seconds to plant one peashooter. Once the peashooter is planted, it will begin to shoot at the zombies at its row. The zombies have different speed Vi and defense Di, which means that, the zombie in the i-th row will need Vi seconds to walk through the yard, and will be killed after Di seconds of shooting. Please note that you can plant only one peashooter at each row. Output Output one line for each test case. If you can kill althe zombies, output N numbers separated by a space, which is, a permutation of 1, 2,N, indicating the order of your planting. If you cannot defend your yard, output "The zombies will eat your brainl" in ane line. Sample Input 10 20 10 40 10 30 10 10 20 10 40 11 30 10 Sample Output zombies will eat your brain! Hint: For the first case, you should plant a peashooter in the first row, then plant in the third row, then the second row. Then all the zombies will be killed just in time. For the second case, however, the zombie in the second row is a little stronger, so you cannot kill all of them. Other Requirements . Usc a structure to represent cach zombic. Unfortunately, in some cases where the zombies are too fast and/or too strong and/or your planting is too slow, you cannot kill all the zombies in time, so the zombies will cat your brain. Input There are several test cases in the input. The first line of each test case contains two integers N (1NStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started