Children's Day

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
[pre] a e bdf c g h n i mo jl p k q ......... r j [/pre]
Hint
Not all the resultsare listed in the sample. There are just some lines. The ellipsis expresseswhat you should write.
 
Source
 1 #include <stdio.h>
 2 #include <string.h>
 3 using namespace std;
 4 
 5 char a[15][15];
 6 char ch(char c)
 7 {
 8     return 'a'+(c-'a'+1)%26;
 9 }
10 char change(int j,char c)
11 {
12     int i,k;
13     memset(a,' ',sizeof(a));
14     for(i=0; i<j; i++) a[i][0]=c, c=ch(c);
15     for(i=1; i<j-1; i++) a[j-i-1][i]=c,c=ch(c);
16     for(i=0; i<j; i++) a[i][j-1]=c,c=ch(c);
17 
18     for(i=0; i<j; i++)
19     {
20         for(k=0; k<j; k++)
21         {
22             if(a[i][k]!=' ') printf("%c",a[i][k]);
23             else printf(" ");
24         }
25         puts("");
26     }
27 
28     return c;
29 }
30 int main()
31 {
32     int t,i;
33     char ch='a';
34     for(i=3; i<=10; i++) ch=change(i,ch);
35     return 0;
36 }
View Code

 

posted @ 2013-09-09 21:36  1002liu  阅读(169)  评论(0编辑  收藏  举报