首页 技术 正文
技术 2022年11月20日
0 收藏 504 点赞 2,760 浏览 1427 个字

Children’s Day

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 1733    Accepted Submission(s): 1121

Problem DescriptionToday 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’). InputThis problem has no input. OutputOutput 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]HintNot all the resultsare listed in the sample. There are just some lines. The ellipsis expresseswhat you should write.

 

迷失在幽谷中的鸟儿,独自飞翔在这偌大的天地间,却不知自己该飞往何方……

#include <iostream>
#include <cmath>
#include <stdio.h>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;
char mp[20][20];
char nextc(char c)
{
if(c=='z')return 'a';
else return ++c;
}
int main()
{
char cur='a';
int i,j,k;
for(i=3; i<=10; i++)
{
memset(mp,' ',sizeof(mp));
for(j=0; j<i; j++)
{
mp[j][0]=cur;
cur=nextc(cur);
}
for(j=i-2,k=1; j>0; j--,k++)
{
mp[j][k]=cur;
cur=nextc(cur);
}
for(j=0; j<i; j++)
{
mp[j][i-1]=cur;
cur=nextc(cur);
}
for(j=0; j<i; j++)
{
for(k=0; k<i; k++)
printf("%c",mp[j][k]);
printf("\n");
}
}
return 0;
}

上一篇: vue中的虚拟DOM树
下一篇: php编译器
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,075
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,551
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,399
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,811
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,892