HDU 4706:Children's Day
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
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').
[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;
}
HDU 4706:Children's Day的更多相关文章
- hdu 4706 Children's Day(模拟)
http://acm.hdu.edu.cn/showproblem.php?pid=4706 [题目大意]: 用a-z排出N的形状,输出大小为3-10的N,如果超过z之后,重新从a开始 下面是大小为3 ...
- HDU 4706 Children's Day(简单模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4706 题目大意:要用‘a’-‘z’ 26个小写字母输出倒着写得字母'N'的形状,例如 a ebdfc ...
- HDU 4706 Children's Day (水题)
Children's Day Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- hdu 4706:Children's Day(模拟题,模拟输出大写字母 N)
Children's Day Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- hdu 4706 Children's Day 2013年ICPC热身赛A题 模拟
题意:按字母顺序排列成n型,简单的模拟题. 当字母排到z时从a开始重新排起. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blog: ...
- hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup
http://acm.hdu.edu.cn/showproblem.php?pid=4706 Children's Day Time Limit: 2000/1000 MS (Java/Others) ...
- HDOJ/HDU 1297 Children’s Queue(推导~大数)
Problem Description There are many students in PHT School. One day, the headmaster whose name is Pig ...
- HDU 1297 Children’s Queue (递推、大数相加)
Children’s Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- hdu 4706
注意一点 空的地方打空格而不是空字符,我因为这wa了一次... #include<cstdio> #include<cstring> #include<cstdlib&g ...
随机推荐
- MVC1
- Effective C++ 6.继承与面向对象设计
//条款32:确定你的public继承塑模出is-a关系 // 1.public继承意味着is-a的关系,适用在基类上的方法都能用于派生类上. //条款33:避免遮掩继承而来的名称 // 1.在pub ...
- PostgreSQL Replication之第十章 配置Slony(3)
10.3 复制您的第一个数据库 这个小小的介绍之后,我们可以继续前进并复制我们的第一个数据库.要做到这一点,我们可以在一个数据库实例上创建两个数据库.我们想简单地在这两个数据库之间进行复制. [ 您在 ...
- Leetcode: Number of Islands II && Summary of Union Find
A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand oper ...
- 01分数规划POJ3621(最优比例生成环)
Sightseeing Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8218 Accepted: 2756 ...
- CentOS 7 自动更新时间日期
# ntpdate time.nist.gov 或 # rdate -s time.nist.gov 下列服务器可用 time-nw.nist.gov
- android开发之如何使TabHost的TabWidget位于屏幕下方
更改TabHost里的第一个LinearLayout为RelativeLayout.并在TabWidget中添加android:layout_alignParentBottom="true& ...
- sql 把一列的数据按逗号分隔转换成多行
ALTER proc [dbo].[ModifyWkCashAccountNo]asbeginset xact_abort onbegin transactiondeclare @errors int ...
- JSP-09-使用EL显示数据
目的:为了使JSP写起来更加简单. 9.1 EL表达式 ${EL表达式} : ${unsername} 操作符: “. ”操作符: 用来访问对象的属性 ${news.title} “[ ...
- [Mongo] How to Install Mongo on Debian(不要安装)
Install MongoDB on Debian¶ This tutorial outlines the steps to install MongoDB on Debian systems. Th ...