Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please provide java stdin, stdout code for this problem - Pumpkin Pete is trying out a new type of rapid-growth pumpkin seed that

Can you please provide java stdin, stdout code for this problem - Pumpkin Pete is trying out a new type of rapid-growth pumpkin seed that he bought from the farmers market. Without looking at the directions, Pumpkin Pete tears through the packaging and plants the seeds he has into his pumpkin patch. Unbeknownst to Pumpkin Pete, his rival, Gourd Gary, is watching him plant the new seeds from a secret vantage point. After Pumpkin Pete leaves the pumpkin patch, Gourd Gary approaches the patch and picks up the packaging that Pumpkin Pete left on the ground. The packaging says the following: A pumpkin starts with four roots of length zero. Each of the pumpkins four roots grow a single unit in a different cardinal direction each day. When a pumpkin dies, its remains will not disappear. If any of the roots grow into another pumpkin or its roots dead or alive the pumpkin will die at the end of that day. Roots cannot grow outside of the bounds of a plot. In other words, a pumpkin will die if one of its roots tries to go outside the bounds of the pumpkin patch. If the roots of multiple pumpkins reach the same spot on the same day, each one of the affected roots stops growing (i.e. fight for nutrients) and in turn, the pumpkins will die at the end of the day. When a pumpkin dies, its roots do not grow on subsequent days. With this information and the knowledge of where each of the pumpkin seeds were planted, Gourd Gary starts to think about which pumpkins would still be alive if they were left to grow for D days Input: The first line of input contains three integers: the number of pumpkins P, the number of days D that will pass (1D10), and N (1N30,1PN2) the dimension of the NN grid. he next P lines of input contain two integers, R and C (0R,C

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_2

Step: 3

blur-text-image_3

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions