HDU4706-Children's Day

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;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

光仔December

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值