Children's Day(4706)

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.


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <stack>
#include <set>
#include <map>
#include <string>
using namespace std;
#define pi acos(-1,0)


int main()
{
	int size=3;
	int i,j;
	char s[11][11];
	char c='a';
	while(size<11)
	{
		memset(s,' ',sizeof(s));
		for(i=1;i<=size;i++)
		{
			if(i==1 || i==size)
			{
				for(j=1;j<=size;j++)
				{
					s[j][i]=c;					
					if(c=='z')
					c='a';
					else 
					c++;
				}
			}
			else
			{
				s[size+1-i][i]=c;
				if(c=='z')
				c='a';
				else 
				c++;
			}	
		}	
		for(i=1;i<=size;i++)
		{
			for(j=1;j<=size;j++)
			{
				printf("%c",s[i][j]);
			}
			printf("\n");
		}
		size++;
	}
		
	return 0;
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章