# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12884 | Patruto and Spongebob run away |
|
13259 | Learning Fibonacci |
|
13260 | Nappa's Attack |
|
13263 | Star Diamond |
|
Description
After finishing dinner in SAO, it's time to have the bill. But Spongebob only has bubble-money and Patrick only has rock-money.
Of course they can't pay in neither bubble-money nor in rock-money. So the cashier is so mad that he calls the police to catch them. Spongebob and Patrick feel scared and they run away immediately(please don’t imitate them). To prevent from being caught, Patrick decide to cosplay a ninja.
Assuredly Patrick needs to move like a ninja, too. Formally we call "moving like a ninja" is that the footprint he left will form a swirl like the design on the forehead which Patrick put on. And you have to help Patrick to move like a ninja.
To simplify the problem, we consider Patrick is on a 2n x 2n grid. And he is at the upper-left cell (1,1) in the begining. When he starts to move, he will go right continuously until the next cell he will move to is out of bounds or has been visited before. Then he will go down with the same pattern(stops when the next cell is out of bounds or has been visited). Similarly he goes left and goes up with the same pattern. And continue to keep going right, going down, going left, going up, going right, going down… until he can’t move anymore.
What you have to do is to offer a map. And there must be a 2n x 2n grid on the map and all the cells in the grid are noted the order Patrick should visit. In this way Patrick can move like a ninja by following your map(don’t worry about Patrick’s counting ability).
The following image shows the example of n = 3(so the grid is 6 x 6).
Subtask
- for testcase 1: n = 1
- for testcase 2: n = 2
- for testcase 3: n = 3
- for testcase 4: n = 4
- for testcase 5~10: no additional restriction
Input
The first line contains one integer n (1 ≤ n ≤ 250) – the size of the grid which Patrick moves on.
Output
Output a 2n x 2n grid which is the map Patrick will follow.
Please reference the format of sample output and do not output space at the end of any line.
Remember to print a newline('\n') at the end of the last line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Jonny Joestar is trying to learn about the Golden Rectangle but he is not that smart, so his friend, Gyro Zepelli, is trying to teach him the Fibonacci sequence. In order to help him understand the FIbonacci sequence he needs to make a program that prints out the first N numbers of the Fibonacci sequence.
The Fibonacci sequence are the numbers in the following intergur sequence:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the first two numbers in the Fibonacci sequence (0 and 1) and each subsequent number is the sum of the previous two.
Input
The input will contain a single integer N
0<N<10000
Output
You must print the first N numbers from the Fibonacci sequence. There must be a space after every number. There must also be a new line at the end.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Nappa is on his way to destroy a city for some fun, however on his way there, he was stopped by an army shooting at him so Nappa decided to destroy them for fun too.
Before he destroyed them, he noticed that the men in the army form a pattern. Each group forms a triangular shape as follows:
The strongest one is at the center and is protected by layers of weaker soldiers and those soldiers are protected by even weaker soldiers.
There are many sizes and Nappa wants to see every pattern there could be so he must write a program in his scouter to show him every possibility of this pattern.
Input
The input will contain a single integer N, the strongest soldier at the center.
0<N<1000
Output
The output will require you to print the entire traingle pattern with the strongest soldier at the center having the N power level.
There need not be space between numbers but there should be a new line at the end of every line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Print a star diamond composed of symbol * with layer N.
The first layer and the last layer should contain only one stars.
For Layers below the middle layer,
Input
0<N<1000
Output
Star diamond.
Detail will show in sample output.
If N is even, print "Stop drawing fake diamonds!"
Remember put "\n" at the end of each line.