Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

HW 6-rec: when do a spaceship can land in a city?

C
Claudia Istoc (480 points)
0 2 4
in HW6 by (480 points)
closed by
Good evening everyone,

I'm having a lot of problems in the recovery hw 6. I cannot find where I'm wrong, so I supposed that maybe I didn't understand the text.

So here one thing I could eventually got wrong: when do a spaceship can land in a city?

In the tests I find errors in the return values: sometimes I have a different list by the true one.

Thank you in advance
174 views
closed with the note: answered

1 Answer

andrea.sterbini (208020 points)
756 1270 2377
by (208k points)

A spaceship with size W, H and doors D can land if there is a position x, y such that:

  • All pixels in the rectangle WxH positioned with the upper left corner in x, y are black
  • All pixels in the 4 rectangles WxD or DxH on the 4 sides of the spaceship are black
Please be very precise in computing the pixels of the rectangles to be checked