Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 (1N

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

DESCRIBE how accidents at work can be prevented .

Answered: 1 week ago

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago

Question

LO2 Compare three types of individual incentives.

Answered: 1 week ago