Previous Questions Print cross charttime limit: 1.0s memory limit: 256.0MB
Problem Description
Xiao Ming designed a cross-shaped logo for an institution (not the Red Cross), as shown below:
.. $$$$$$$$$$$$$..
.. $...........$..
$$$.$$$$$$$$$.$$$
$...$.......$...$
$.$$$.$$$$$.$$$.$
$.$...$...$...$.$
$.$.$$$.$.$$$.$.$
$.$.$...$...$.$.$
$.$.$.$$$$$.$.$.$
$.$.$...$...$.$.$
$.$.$$$.$.$$$.$.$
$.$...$...$...$.$
$.$$$.$$$$$.$$$.$
$...$.......$...$
$$$.$$$$$$$$$.$$$
.. $...........$..
.. $$$$$$$$$$$$$..
The other side also needs to be in the Computer DOS window in the form of characters to output the flag, and can control the number of layers.
Input Formata positive integer n (n<30) indicates the number of layers required to print the graphic.
output Formatcorresponds to the flag that encloses the number of layers.
Sample Input 11
Sample Output 1.. $$$$$..
.. $...$..
$$$.$.$$$
$...$...$
$.$$$$$.$
$...$...$
$$$.$.$$$
.. $...$..
.. $$$$$..
Sample Input 23
Sample Output 2.. $$$$$$$$$$$$$..
.. $...........$..
$$$.$$$$$$$$$.$$$
$...$.......$...$
$.$$$.$$$$$.$$$.$
$.$...$...$...$.$
$.$.$$$.$.$$$.$.$
$.$.$...$...$.$.$
$.$.$.$$$$$.$.$.$
$.$.$...$...$.$.$
$.$.$$$.$.$$$.$.$
$.$...$...$...$.$
$.$$$.$$$$$.$$$.$
$...$.......$...$
$$$.$$$$$$$$$.$$$
.. $...........$..
.. $$$$$$$$$$$$$..
TipsPlease observe the sample carefully, especially the number of periods and the output position. this problem to see a half-day to understand the meaning of the topic, Khan ...
Java source code:
1 ImportJava.util.Scanner;2 3 Public classMain {4 Public Static voidMain (string[] args) {5 intn =NewScanner (system.in). Nextint ();6 CharA[][] =New Char[n * 4 + 5] [n * 4 + 5];7 for(inti = 0; i < a.length; i++) {8 for(intj = 0; J < A[i].length; J + +) {9A[I][J] = '. ';Ten } One } A intt = 0; - for(inti = 0; I < n; i++, T + = 2) { - for(intj = T + 2; J < a.length-t-2; J + +) { theA[T][J] = ' $ '; -A[j][t] = ' $ '; -A[a.length-t-1][J] = ' $ '; -A[J][A.LENGTH-T-1] = ' $ '; + } - for(intj = t; J <= T + 2; J + +) { +A[j][t + 2] = ' $ '; AA[t + 2][j] = ' $ '; atA[a.length-t-3][J] = ' $ '; -A[J][A.LENGTH-T-3] = ' $ '; - } - for(intj = a.length-1-t-2; J <= A.length-1-T; J + +) { -A[j][t + 2] = ' $ '; -A[t + 2][j] = ' $ '; inA[a.length-1-T-2][J] = ' $ '; -A[j][a.length-1-t-2] = ' $ '; to } + } - intm = A.LENGTH/2; the for(intj = A.LENGTH/2-2; J <= m + 2; J + +) { *A[J][M] = a[m][j] = ' $ '; $ }Panax Notoginseng - for(inti = 0; i < a.length; i++) { the for(intj = 0; J < A[i].length; J + +) { + System.out.print (A[i][j]); A } the System.out.println (); + } - } $}
Evaluation Point serial number |
Evaluation Results |
score |
CPU Usage |
Memory Usage |
Download Evaluation Data |
1 |
That's right |
50.00 |
218ms |
24.33MB |
Input/Output |
2 |
That's right |
50.00 |
234ms |
25.00MB |
Input/Output |
"Blue Bridge Cup" printed cross-section of previous questions