HDOJ 4706 Children's Day
2015-12-18 12:27
204 查看
Children's Day
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1643 Accepted Submission(s): 1053
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
[pre]
a e bdf c gh n
i mo
jl p
k q
.........
r j
[/pre]
Hint
Not all the resultsare listed in the sample. There are just some lines. The ellipsis expresseswhat you should write.
暴力 #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; int main() { printf("a e\nbdf\nc g\n"); printf("h n\ni mo\njl p\nk q\n"); printf("r z\ns ya\nt x b\nuw c\nv d\n"); printf("e o\nf np\ng m q\nh l r\nik s\nj t\n"); printf("u g\nv fh\nw e i\nx d j\ny c k\nzb l\na m\n"); printf("n b\no ac\np z d\nq y e\nr x f\ns w g\ntv h\nu i\n"); printf("j z\nk ya\nl x b\nm w c\nn v d\no u e\np t f\nqs g\nr h\n"); printf("i a\nj zb\nk y c\nl x d\nm w e\nn v f\no u g\np t h\nqs i\nr j\n"); return 0; }
#include <stdio.h> #include <string.h> int main(){ char ch[30]="abcdefghijklmnopqrstuvwxyz"; //将要输出的字符存到数组里 char map[15][15]; int cnt = 0; for(int i=3;i<=10;i++){ //规模 memset(map,' ',sizeof(map)); //注意每次都要清空 for(int j=0;j<i;j++){//最左边一列 map[j][0] = ch[cnt%26]; cnt++; } for(int j=i-2;j>=1;j--){ //对角线 map[j][i-j-1]=ch[cnt%26]; cnt++; } for(int j=0;j<i;j++){ //最右边一列 map[j][i-1]=ch[cnt%26]; cnt++; } for(int j=0;j<i;j++){ //输出 for(int k=0;k<i;k++){ printf("%c",map[j][k]); } printf("\n"); } } return 0; }
相关文章推荐
- 存储过程的常见结构
- mac中的echo颜色输出
- Leetcode: The Skyline Problem
- libevent安装
- 我学ASP.Net---新手(分页显示)
- boost源码剖析之:泛型函数指针类boost::function(rev#3)
- Oracle经常使用函数
- boost源码剖析之:Tuple Types(rev#2)
- android之getDimension、getDimensionPixelSize、getDimensionPixelOffset区别
- handler 使用
- 搜索引擎与浏览器的上层结构
- POJ 3984 迷宫问题 --- BFS
- Android笔记(2)---帧布局实现霓虹灯效果
- Javascript Charts
- bzoj4012: [HNOI2015]开店
- HDOJ 2091 空心三角形
- 数据结构实验 第三单元 二进制转换
- hdu2066
- mysql安装(debian)
- 数据结构实验 第三单元 队列操作