Children's Day
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 781 Accepted Submission(s): 501
Problem Description
Today is Children's Day. Some children ask you to output a big letter 'N'. 'N' is constituted by two vertical linesand one diagonal. Each pixel of this letter is a character orderly. No tail blank is allowed.
For example, this is a big 'N' start with 'a' and it's size is 3.
a e
bdf
c g
Your task is to write different 'N' from size 3 to size 10. The pixel character used is from 'a' to 'z' continuously and periodic('a' is reused after 'z').
Input
This problem has no input.
Output
Output different 'N' from size 3 to size 10. There is no blank line among output.
Sample Output
a e
bdf
c g
h n
i mo
jl p
k q
.........
r j
Hint
Not all the resultsare listed in the sample. There are just some lines. The ellipsis expresseswhat you should write.
Source
2013 ACM/ICPC Asia Regional Online —— Warmup
//没啥说的,二位数组画图...找规律
AC代码:
#include<stdio.h> #include<String.h> #include<ctype.h> char a[15][15]; char English[27]="abcdefghijklmnopqrstuvwxyz"; int main() { int i,j,n,m,p; n=3;m=1;p=0; while(n<=10&&m<=8) { memset(a,0,sizeof(a)); for(i=0;i<n;i++)//左边的按0,0开始从上到下排 { a[i][0]=English[p++]; if(p>25)//到z之后让其从a开始 p=0; } int x=n-2,y=1,r=m; while(r--)//中间的按从左下方到右下方排 { a[x--][y++]=English[p++]; if(p>25) p=0; } for(i=0;i<n;i++)//右边的按0,n-1从上到下排 { a[i][n-1]=English[p++]; if(p>25) p=0; } for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(isalpha(a[i][j]))//输出有字母的,没有的就设为空格 printf("%c",a[i][j]); else printf(" "); } puts(""); } n++;m++;//扩大“N” } return 0; }