joj2485
2485: Welcome, 2008
Result | TIME Limit | MEMORY Limit | Run Times | AC Times | JUDGE |
---|---|---|---|---|---|
![]() |
3s | 65536K | 1454 | 677 | Standard |
For Chinese people, 2008 is a special year. The 29th Olympic Games will be held in Beijing. In order to express our enthusiasm, we draw a big symbol '8'.
Input
Each line of input is a positive integer N (N<=40). The input file is terminated by N=0.
Output
For each input N, you should write a fixed symbol 8 using character '*' with given size N. The width of your drawing is N+1, and the height is 2*N+1. Just see the sample to understand the detail. Output one blank line after each symbol.
Sample Input
1 2 3 0
Sample Output
** ** ** *** * * *** * * *** **** * * * * **** * * * * ****
Problem Source: provided by skywind
This problem is used for contest: 103 146
Submit / Problem List / Status / Discuss
#include<stdio.h>
int main(void)
{
int n, i, j, k;
while (scanf("%d", &n) != EOF)
{
if (n == 0)
break;
for (i=1; i<=2*n+1; i++)
{
if (i==1 || i==n+1 || i==2*n+1)
{
for (j=1; j<=n+1; j++)
{
printf("*");
}
printf("\n");
}
else
{
for (k=1; k<=n+1; k++)
{
if (k==1 || k == n+1)
printf("*");
else
printf("");
}
printf("\n");
}
}
printf("\n");
}
return 0;
}