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的土地,现在对每一块土地有两种操作,最多只能在每块土地上进行两种操作,第一种 ...
随机推荐
- Android图片下载以及缓存框架
实际开发中进行图片下载以及缓存的框架 介绍一下开发中常见图片加载框架的使用和对比一下优缺点. 1.Picasso 框架 在Android中开发,常需要从远程获取图片并显示在客户端,当然我们可以使用原生 ...
- 遍历JavaScript某个对象所有的属性名称和值
/* * 用来遍历指定对象所有的属性名称和值 * obj 需要遍历的对象 */ function allPrpos(obj) { // 用来保存所有的属性名称和值 var props = " ...
- 小程序数组合并concat
arr1=arr1.concat(arr2) 文章来源:刘俊涛的博客 地址:http://www.cnblogs.com/lovebing 欢迎关注,有问题一起学习欢迎留言.评论.
- React.Fragment 包裹标签
在 vue 里,我们会用 <template></template> 标签来包裹一些不能有父容器的复数同级标签. 例如在 <tbody></tbody> ...
- python求pi的方法
来自 #_*_ coding=utf-8 *_* ## {{{ http://code.activestate.com/recipes/578130/ (r5) def pi(places=10): ...
- 2013夏,iDempiere来了 - v1.0c Installers (Devina LTS Release) 2013-06-27
怀揣着为中小企业量身定做一整套开源软件解决方案的梦想开始了一个网站的搭建.http://osssme.org/ iDempiere来了 - v1.0c Installers (Devina LTS R ...
- java基础讲解03-----java的结构
前面我们说了java是面向对象的语言,java程序的基本组成单元是类,类中又属性,方法两个部分,每个应用程序都会有一个mian函数,含有main()方法的类,我们称为主类 package Test; ...
- crc32 根据字符串获取校验值
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text; n ...
- ftp客户端的创建
1.本段代码采用了 select I/O端口复用 2.含有三种功能:ls, 上传文件, 下载文件.这是拷贝别人的代码,自己添加了注释,随后会进行修改, 自己需要的功能:上传文件, 下载文件, (并 ...
- 设置右上角的菜单button
效果如图: 刚開始是单独做了个button.发现无法调margin,后来想到外面套一个布局 <?xml version="1.0" encoding="utf-8& ...