hdu 4706:Children's Day(模拟题,模拟输出大写字母 N)
Children's Day
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 648 Accepted Submission(s): 422
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').
a e
bdf
c g
h n
i mo
jl p
k q
.........
r j
Not all the resultsare listed in the sample. There are just some lines. The ellipsis expresseswhat you should write.
#include <iostream> using namespace std; int main()
{
int n; //size
int c = ; //该尺寸的第一个字母的序号
for(n=;n<=;n++){ //循环尺寸
int i,j; //该尺寸的第i行,和该行第j个元素
int c1=c%,c2=(c+*n-)%; //分别记录每一行的第一个字母和最后一个字母序号
if(c1==) c1=;
if(c2==) c2=;
for(i=;i<=n;i++){ //行
int k=n+-i; //每一行中间元素的位置
for(j=;j<=n;j++){ //该行每一个元素
if(j==)
cout<<char(c1+'a'-);
else if(j==n)
cout<<char(c2+'a'-);
else if(j==k){ //中间元素
int kc = (c+n+k-)%;
if(kc==) kc=;
cout<<char(kc+'a'-);
}
else
cout<<' ';
}
cout<<endl;
c1=(c1+)%,c2=(c2+)%;
if(c1==) c1=;
if(c2==) c2=;
}
c=(c+*n-)%;
if(c==)
c=;
}
return ;
}
Freecode : www.cnblogs.com/yym2013
hdu 4706:Children's Day(模拟题,模拟输出大写字母 N)的更多相关文章
- hdu 4706 Children's Day 2013年ICPC热身赛A题 模拟
题意:按字母顺序排列成n型,简单的模拟题. 当字母排到z时从a开始重新排起. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blog: ...
- HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011亚洲北京赛区网络赛)
HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 ...
- HDU 4452 Running Rabbits (模拟题)
题意: 有两只兔子,一只在左上角,一只在右上角,两只兔子有自己的移动速度(每小时),和初始移动方向. 现在有3种可能让他们转向:撞墙:移动过程中撞墙,掉头走未完成的路. 相碰: 两只兔子在K点整(即处 ...
- HDU 2414 Chessboard Dance(模拟题,仅此纪念我的堕落)
题目 模拟题也各种wa,我最近真的堕落了,,,,,智商越来越为负数了!!!!!!!! #include<stdio.h> #include<string.h> #include ...
- 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 4119 Isabella's Message 模拟题
Isabella's Message Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.p ...
- HDU 4925 Apple Tree(模拟题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4925 解题报告:给你n*m的土地,现在对每一块土地有两种操作,最多只能在每块土地上进行两种操作,第一种 ...
随机推荐
- 使用Firefly编写简易聊天室
1.创建工程命令行下输入firefly-admin.py createproject chat_rooms(linux在终端输入),<ignore_js_op> firefly会在C盘Us ...
- linux 安装mysql 5.6.11
tar zxvf mysql-.tar.gz cd mysql- cmake . -DCMAKE_INSTALL_PREFIX=/home/mysql/ -DMYSQL_DATADIR=/home/m ...
- JMX 学习
http://blog.csdn.net/qiao000_000/article/category/763467
- iOS-UICollectionView快速构造/拖拽重排/轮播实现
代码地址如下:http://www.demodashi.com/demo/11366.html 目录 UICollectionView的定义 UICollectionView快速构建GridView网 ...
- Android--从零开始开发一款文章阅读APP
代码地址如下:http://www.demodashi.com/demo/11212.html 前言 本案例已经开源!如果你想免费下载,可以访问我的Github,所有案例均在上面,只求给个star.当 ...
- ZooKeeperEclipse 插件
插件地址:ZooKeeperEclipse http://www.massedynamic.org/eclipse/updates/ 安装ZooKeeperEclipse插件步骤如下: Step 1 ...
- AES加密在windows与linux平台下显示结果不同,解决方案
现象描述: 在 windows 操作系统下加解密正常,但部署到 linux 环境中相同的输入加密结果不正确,并且每次运行返回的结果都不同.也就是说在windows下加解密都正常,一但部署到linux下 ...
- 使用struts的时候form用struts的,不用html本身的
同样的struts-config.xml, web.xml的配置,使用2个版本的form,只有struts的form才能成功运行 使用html版本的form导致post的路径不对,报404 HTML版 ...
- 解决:eclipse配置Database Connections报错Communications link failure Last packet sent to the server was 0 ms ago
网上各式各样的问题,不过我的问题在于我开了Proxifier,导致链接localhost的时候被拦截...把Proxifier关了就好了 以后遇到这种问题.连不上数据库啊,连不上本地的服务器啊,先检查 ...
- java性能监控工具:jmap命令详解
.命令基本概述 Jmap是一个可以输出所有内存中对象的工具,甚至可以将VM 中的heap,以二进制输出成文本.打印出某个java进程(使用pid)内存内的,所有‘对象’的情况(如:产生那些对象,及其数 ...