您的位置:首页 > 其它

Children's Day(4706)

2015-07-29 21:32 295 查看
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 gh 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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c