# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13260 | Nappa's Attack |
|
13263 | Star Diamond |
|
13599 | Find the amount of the pattern |
|
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.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
One day, Patrick is curious about how many flower-like cloud are there in the picture he took. He tried to count them himself, but it is so difficult for him to count one after one. Smart Squidward tell him that it is possible to count easier by the follwing method:
1. You need a image (e.g. sky picture) that each pixel contains only 0(black) and 1(white), which is also called as binary image
2. Obtain another image that describe the pattern you are curious about
3. Scanning through the whole binary image with the pattern image to count the amount of the desired pattern
For example,
Given the binary image:
, which can represent as a matrix:
1 0 1 0 0
0 1 0 1 0
0 0 1 0 1
1 1 0 0 0
0 0 1 0 0
and the pattern image:
, which can represent as a matrix:
1 0 0
0 1 0
0 0 1
then the amount of the desire pattern is 2.
Input
The first line contains one integer n (2 ≤ n ≤ 20) – the size of the binary matrix.
Then the following n * n numbers are the value of this matrix, the value is either 0 or 1.
Then the next line will contains one integer m (2 ≤ m ≤ n ) – the size of the patten matrix.
Finally, the following m * m numbers are the value of this matrix, the value is either 0 or 1.
Output
The amount of the desire pattern.
You need to print a newline character at the end. ('\n')