Solar Doomsday
You've managed to infiltrate Commander Lamda's evil organization and finally earned yourself an entry-level position as a Minion on their space station. From here, you just might be able to subvert Commander Lambda's plan to use LAMBCHOP doomsday device to destroy Bunny Planet. Problem is, Minions are the lowest of the low in the Lambda hierarchy. Better buck up and get working, or you'll never make it to the top.
request
You are about to begin a TIME-LIMITED challenge. You will have 7 days to complete each newly requested challenge or LOSE ACCESS to this site.
Y
Next time Bunny HQ needs someone to infiltrate a space station to rescue bunny workers, you're going to tell them to make sure 'stay up for 48 hours straight scrubbing toilets' is part of the job description. It's only fair to warn people after all.
cd solar-doomsday
cat readme.txt
Who would've guessed? Doomsday devices take a LOT of power. Commander Lambda wants to supplement the LAMBCHOP's quantum antimatter reactor core with solar arrays, and you've been tasked with setting up the solar panels.
Due to the nature of the space station's paneling, all of its solar panels must be squares. Fortunately, you have one very large and flat area of solar material, a pair of industrial-strength scissors and enough MegaCorp Solar Tape(TM) to piece together any excess panel material into more squares. For example, if you had a total area of 12 square yards of solar material, you would be able to make one 3x3 square panel and three 1x1 square solar panels.
Write a function solution(area) that takes as its input a single unit of measure representing the total area of solar panes you have (between 1 and 1.000.000 inclusives) and returns a list of the areas of the largest squares you could make out of those panels, starting with the largest squares first.
solution(12) = [9,1,1,1]
solution(15324) = [15129,169,25,1]
import math
def solution(area):
sol = []
sisa = area
while(sisa > 0):
s = math.floor(math.sqrt(sisa))
sol.append(int(s*s))
sisa = sisa - (s*s)
return sol
You survived a week in Commander Lambda's organization, and you even managed to get yourself promoted. Hooray! Henchmen still don't have the kind of security access you'll need to take down Commander Lambda, though, so you'd better keep working. Chop chop!