Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help to solve this problem using python with dynamic programming! I tried to solve it but got this error! can you revise it and

please help to solve this problem using python with dynamic programming!
I tried to solve it but got this error! can you revise it and make sure it gots the correct output!
image text in transcribed
image text in transcribed
image text in transcribed
C. Snack Attack time limit per test: 1 second 0 memory limit per test: 256 megabytes input: standard input output: standard output Catch popcorn, not boulders! If a boulder hits you, you'll spill some popcorn! (100 points) Snack Attack is a four player minigame in Super Mario Party and you can view how the game is actually played here. The goal of the game is to catch as many kernels of popcorn that fall from the sky using the cups on top of each players' head. In addition to popcorn, boulders will fall from the sky. The boulders are too big to catch with the cup, and so if hit by one, the player will lose half of their current popcorn kernels in the cup. The original game is set in a circular area, but in this problem we will assume it is a square grid for simplicity. If a popcorn kernel falls onto some cell (r,c) at time t and a player is also at the same cell at the same time, this player will get a popcorn kernel. On the other hand, if at time t, a boulder falls onto cell (r,c), this player will lose h/2 popcorn kernels, where h is the current number of popcorn kernels in their cup (e.g., if you now only have 3 popcorn kernels, you will lose 2 and only 1 is left). The players can move at a speed of 1 cell per second and we assume that movement is not affected by any popcorn or boulders. In other words, each second a player can move from the current position to any adjacent cell (on the left, right, top or bottom) or stay at the same location, and they are not slowed down by all of the popcorn nor will they be stunned by a boulder hit. Given the positions of all falling popoorns and boulders, the time that each will fall, and the initial position of the player, we want to know what is the maximum amount of popcorn this player can catch if they play through until the end. Input The first line of the input contains three integers, n(0<100>

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions

Question

What standard does the courts apply when determining custody?

Answered: 1 week ago