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;
}
相关文章
hdoj 1028/poj 2704 Pascal's Travels(记忆化搜索||dp)
有个小球,只能向右边或下边滚动,而且它下一步滚动的步数是它在当前点上的数字,如果是0表示进入一个死胡同。求它从左上角到右下角到路径数目。 注意, 题目给了提示了,要用64位的整数。
37 0
Codeforces Round #748 (Div. 3) E. Gardener and Tree(拓扑排序)
Codeforces Round #748 (Div. 3) E. Gardener and Tree(拓扑排序)
89 0
HDU-1598,find the most comfortable road(并查集+枚举)
HDU-1598,find the most comfortable road(并查集+枚举)
|
Java
HDOJ/HDU 1297 Children’s Queue(推导~大数)
HDOJ/HDU 1297 Children’s Queue(推导~大数)
136 0
HDOJ/HDU 1062 Text Reverse(字符串翻转~)
HDOJ/HDU 1062 Text Reverse(字符串翻转~)
111 0
HDOJ/HDU 1321 Reverse Text(倒序输出~)
HDOJ/HDU 1321 Reverse Text(倒序输出~)
99 0
|
搜索推荐
HDOJ/HDU 1251 统计难题(字典树啥的~Map水过)
HDOJ/HDU 1251 统计难题(字典树啥的~Map水过)
85 0
|
机器学习/深度学习
HDOJ/HDU 1556 Color the ball(树状数组)
HDOJ/HDU 1556 Color the ball(树状数组)
102 0
HDOJ(HDU) 2162 Add ‘em(求和)
HDOJ(HDU) 2162 Add ‘em(求和)
72 0