3

Easter Bunnies 2D Are Back

 1 year ago
source link: https://www.codeabbey.com/index/task_view/easter-bunnies-2d-are-back
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Easter Bunnies 2D Are Back

Thanks once more to Mathias Kern aka gardengnome for this "sequel"!

Whatever the 1D Easter Bunnies do, the 2D Easter Bunnies can do it too! They are going on an egg hunt across a 2D array of size 166 x 166. At each position in the array, between -100 and +100 eggs can be found. The 2D Easter Bunnies can choose any rectangular subarray. Once more the question is: what’s the most eggs that the bunnies can collect?

Input: A single integer X0 that is used as the seed for the Linear Congruential Generator introduced in the problem 25 - use A=445, C=700001 and M=2097152. Generate the first 166 x 166 values from this sequence and transform each value via value % 201 - 100 to the desired range from -100 to +100. The array is filled left to right, top to bottom.

Output: The maximum number of eggs the Easter Bunnies can get.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK