Vasya 的生日快到了,Lena 決定縫製一條有圖案的手帕送給他當禮物。Lena 選擇了從 0 到 n 的數字作為圖案。這些數字將組成一個菱形(rhombus)。最大的數字 n 應位於中心位置。當數字向邊緣延伸時應逐漸遞減。
例如,當 n = 5 時,手帕的圖案應該是要長這樣:
0
0 1 0
0 1 2 1 0
0 1 2 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 4 5 4 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 2 1 0
0 1 2 1 0
0 1 0
0
您的任務是根據給定的 n 來確定手帕最終呈現的樣子。
第一行包含一個整數 n (2 ≤ n ≤ 9)。
輸出給定 n 的圖案。您應嚴格遵守每行第一個數字前的空格數量。同一行中任意兩個相鄰數字之間應恰好由一個空格隔開。每行最後一個數字之後不應有任何空格。
2
0
0 1 0
0 1 2 1 0
0 1 0
0
3
0
0 1 0
0 1 2 1 0
0 1 2 3 2 1 0
0 1 2 1 0
0 1 0
0
Vasya's birthday is approaching and Lena decided to sew a patterned handkerchief to him as a present. Lena chose digits from 0 to n as the pattern. The digits will form a rhombus. The largest digit n should be located in the centre. The digits should decrease as they approach the edges. For example, for n = 5 the handkerchief pattern should look like that:
0
0 1 0
0 1 2 1 0
0 1 2 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 4 5 4 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 2 1 0
0 1 2 1 0
0 1 0
0
Your task is to determine the way the handkerchief will look like by the given n.
The first line contains the single integer n (2 ≤ n ≤ 9).
Print a picture for the given n. You should strictly observe the number of spaces before the first digit on each line. Every two adjacent digits in the same line should be separated by exactly one space. There should be no spaces after the last digit at the end of each line.
| ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |
|||||