• 沒有找到結果。

Can you tell me how many squares and rectangles are hidden there? You can assume that squares are not rectangles

N/A
N/A
Protected

Academic year: 2021

Share "Can you tell me how many squares and rectangles are hidden there? You can assume that squares are not rectangles"

Copied!
1
0
0

加載中.... (立即查看全文)

全文

(1)

10177 (2/3/4)-D Sqr/Rects/Cubes/Boxes?

You can see a (4× 4) grid below. Can you tell me how many squares and rectangles are hidden there?

You can assume that squares are not rectangles. Perhaps one can count it by hand but can you count it for a (100× 100) grid or a (10000 × 10000) grid. Can you do it for higher dimensions? That is can you count how many cubes or boxes of different size are there in a (10× 10 × 10) sized cube or how many hyper-cubes or hyper-boxes of different size are there in a four-dimensional (5× 5 × 5 × 5) sized hypercube. Remember that your program needs to be very efficient. You can assume that squares are not rectangles, cubes are not boxes and hyper-cubes are not hyper-boxes.

Fig: A 4× 4 Grid

Fig: A 4× 4 × 4 Cube

Input

The input contains one integer N (0≤ N ≤ 100) in each line, which is the length of one side of the grid or cube or hypercube. As for the example above the value of N is 4. There may be as many as 100 lines of input.

Output

For each line of input, output six integers S2, R2, S3, R3, S4, R4 in a single line where S2 means no of squares of different size in (N × N) two-dimensional grid, R2 means no of rectangles of different size in (N× N) two-dimensional grid. S3, R3, S4, R4 means similar cases in higher dimensions as described before.

Sample Input 1

2 3

Sample Output 1 0 1 0 1 0 5 4 9 18 17 64

14 22 36 180 98 1198

數據

Fig: A 4 × 4 Grid

參考文獻

相關文件

There are many ways to compose music in the green book. Can you tell me about the ways are used to compose

[r]

For example, as a user of deep learning, you probably need to roughly know how it worksX. Otherwise you might now know what you are doing and what kinds of results you

Dialysis can help you feel better and live longer, but it is not a cure for kidney failure. After you start dialysis, you will need to keep doing it to stay as healthy

However, there exist functions of bounded variation that are not continuously differentiable.... However, there exist bounded functions that are not of

多組樣本重複測量分析方法 多組樣本重複測量分析方法 Repeated measures ANOVA Repeated measures ANOVA..

You need to configure DC1 to resolve any DNS requests that are not for the contoso.com zone by querying the DNS server of your Internet Service Provider (ISP). What should

• To the right of the Draw mode buttons you find push buttons through which you can access all the functions that you need to define and solve the PDE problem: define