The Square Within
Description
Discuss (3 comments)
Bobby is an interior designer on Times Square. As such he often faces the difficulty of dividing up the space to fill it with furniture. The goal of this puzzle is to help him determine how many possibilities he has.
We modelize the problem the following way.
Your program will take a list of room sizes and print their corresponding number of ways to place squares in them.
We modelize the problem the following way.
- the room is a square of size NxN unit 1 ft square
- an object can occupy a single square, or a group of squares which form a square of size MxM (with M lesser than or equal to N in order to fit it in the room)
- a 1x1 square can be put at position (0,0) or at position (1,0) or at position (0,1) or at position (1,1)
- a 2x2 square can be put at position (0,0) only.
Your program will take a list of room sizes and print their corresponding number of ways to place squares in them.
Input Specifications
Your program must take one command line argument:- the file name of the input file containing the various room sizes
1 4 2
Output Specifications
Your program must print the number of ways to place squares in each of the room sizes given in input. Your program must print to the standard output (stdout/printf/echo/puts). It should print one integer per line. Using the above example, the output must be:1 30 5
© CoderCharts - All Rights Reserved
| Type | Puzzle | Pass | 380 | Fail | 18 | ||
| Scoring | Language | Level | Easy | Points | 100 | ||
| Tags | combinational analysis, placement | ||||||
Unit Tests
| Name | CPU Unit | Memory Unit |
|---|---|---|
Feature testTests if the computations are correct for a set of values |
Confirm that you want to switch languages
Your current edits will be lost.
Confirm that you wish to load a previous submission
Your current edits will be lost.