| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11129 | Alphabet Diamond |
|
| 10075 | I2P homework3b |
|
Description
The input is a positive integer x, and you should print a alphabet diamond which has x layers. The alphabet diamond is in increasing alphabet order (A B C ... Z) from the outer to the inner. (x <= 26 )
Before the first alphabet, you should use only spaces to align the alphabet and, any other types of indentation is not acceptable.
Please note that there is no need to print space after the last alphabet in each line and, you only need to print a newline.
Input
One positive integer x, x<=26.
Output
An alphabet diamond (please refer to the output sample)
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The input contains nine different numbers, which are 1 to 9 in some random order, for example, 4 1 5 9 8 7 3 6 2. Now, start from the first place, we get the number 4. It indicates that the next number we need to pick is at the 4th place, which is 9. Likewise, we then go the 9th place and get the number 2. We repeat this process until we go to a place that has already been visited. In this example, we will stop at the second place and get the number 1, because we have found a circle. Therefore, along the way we pick four numbers, 4 9 2 1, and the output is the sum of these numbers, which is 16.
Note that we always start from the first place.
Other examples: Consider the input 2 3 4 5 6 7 8 9 1, the output should be 45 since we will visit the numbers one by one and go back to the beginning. Consider the input 1 9 8 7 6 5 4 3 2, the output should be 1 since we stop immediately and cannot go anywhere. Consider the input 9 2 3 4 5 6 7 8 1, the output should be 10.
Input
A random sequence of the nine different numbers of 1 to 9.
Output
The sum of the numbers being visited. Remember to print a '\n' at the end of the sum.