北邮oj 题
题目描述
Every year,prince prepares a birthday gift for princess.The gift is a box,which is decorated with jewel.
As princess grows older,the level of the jewelry box gradually increase from A to Y.
Every level N jewelry box will be packed in level (N-1) jewelry box(except level 1 jewelry box).
For example,when princess was 1 year old,she got a level-A (level 1) jewelry box.When pricess was 2 years old,she got a level-B(level 2) jewelry box.The level-B(level 2)jewelry box was packed in level-A(level 1) jewelry box.
Because prince has obsessive-compulsive disorder, there will be a paper box between two jewelry box.
Please help prince to determine the birthday gift.
输入格式
The first line contains an integer T.(0<T<=20)
Then T test cases follow.
Each test case contains an interger N(1<=N<=25).It represents princess is N year(s) old.
输出格式
For each test case,output the profile of the gift.
The uppercase letter of the level represents the jewelry box.
The first letter 'Z' in 'ZHI' represents the paper box.
输入样例
2
1
2
输出样例
A
AAAAA
AZZZA
AZBZA
AZZZA
AAAAA
#include <stdio.h>
#include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) {
int t;
scanf("%d",&t); if(t==){
printf("A");
}else{
char box[*t-][*t-];
int j;
int k;
for(k=;k<*t-;k++){
box[][k]='A';
} for(k=;k<*t-;k++){
box[][k]='Z';
}
box[][]='A';
box[][*t-]='A'; int temp;
for(j=;j<*t-;j++){//上半部分
if((j%)==&&j!=){//偶数行
box[j][j-]='Z';
box[j][(*t-)-j]='Z'; for(k=j;k<(*t-)-j;k++){
box[j][k]=box[j-][k]+;
} for(k=;k<j;k++){
if(k!=((*t-)-j)&&k!=j-){
box[j][k]=box[j-][k];
}
}
for(k=(*t-)-j;k<*t-;k++){
if(k!=((*t-)-j)&&k!=j){
box[j][k]=box[j-][k];
}
} } if((j%)!=&&j!=){
for(k=;k<*t-;k++){
if(k!=j-&&k!=(*t-)-j){
box[j][k]=box[j-][k];
}else{
box[j][k]='A'+(j-)/;
}
}
}
}
temp=;
for(j=*t-;j<*t-;j++){
for(k=;k<*t-;k++){ box[j][k]=box[j-temp][k]; }
temp=+temp;
} for(k=;k<*t-;k++){
for(temp=;temp<*t-;temp++){
printf("%c",box[k][temp]);
printf("%s"," ");
}
printf("\n");
} }
return ;
}
北邮oj 题的更多相关文章
- 北邮oj 104. 912星球的研究生
104. 912星球的研究生 时间限制 1000 ms 内存限制 65536 KB 题目描述 最近912星球的研究生入学了,912星球的教务处因此忙的焦头烂额,要求yzr做一个信息管理系统登陆查询研究 ...
- 北邮oj 97. 二叉排序树
97. 二叉排序树 时间限制 1000 ms 内存限制 65536 KB 题目描述 二叉排序树,也称为二叉查找树.可以是一颗空树,也可以是一颗具有如下特性的非空二叉树: 若左子树非空,则左子树上所有节 ...
- 北邮OJ
90. 字符串转换 时间限制 1000 ms 内存限制 65536 KB 题目描述 我们将仅由若干个同一小写字母构成的字符串称之为简单串,例如"aaaa"是一个简单串,而" ...
- 【经验总结】北邮OJ
90. 字符串转换 时间限制 1000 ms 内存限制 65536 KB 题目描述 我们将仅由若干个同一小写字母构成的字符串称之为简单串,例如"aaaa"是一个简单串,而" ...
- 北邮OJ 89. 统计时间间隔 java版
89. 统计时间间隔 时间限制 1000 ms 内存限制 65536 KB 题目描述 给出两个时间(24小时制),求第一个时间至少要经过多久才能到达第二个时间.给出的时间一定满足的形式,其中x和y分别 ...
- 用PHP语言刷OJ题
平常在学校都是用C,C++,Java来刷OJ题,把AC的题用不同的语言再AC一次,基本相当于翻译而已.看到学校的OJ支持提交PHP代码,于是尝试了一下. 首先,得会使用PHP,但是你如果在看这篇博客, ...
- 北邮14&18年软院机试【参考】答案
2014 Problem A. 奇偶求和 题目描述: 给定N个数,分别求出这N个数中奇数的和以及偶数的和. 输入格式 第一行为测试数据的组数T(1<=T<=50).请注意,任意两组测试数据 ...
- 中国石油大学(华东)OJ题目的HTML爬取
这几天刷华东OJ的题,写博客还要复制HTML的代码,感觉麻烦的一批,然后就去摸鱼写了个小爬虫.. 看一下运行效果吧- 输入详细的pid.cid或id即可爬取相应的html代码 一些注意要点: 关键的还 ...
- 北邮新生排位赛1解题报告a-c
<div class="page-header" style="padding-bottom: 9px; margin: 20px 0px 30px; border ...
随机推荐
- SQL 会议消费记录统计
统计 /****** Object: Procedure [dbo].[JOB_UP_Summit_UserConfStat] Script Date: 2014-3-17 10:00:50 **** ...
- Android UI 绘制过程浅析(五)自定义View
前言 这已经是Android UI 绘制过程浅析系列文章的第五篇了,不出意外的话也是最后一篇.再次声明一下,这一系列文章,是我在拜读了csdn大牛郭霖的博客文章<带你一步步深入了解View> ...
- ShellExecute 使用方法
ShellExecute的功能是运行一个外部程序(或者是打开一个已注册的文件.打开一个目录.打印一个文件等等),并对外部程序有一定的控制. 有几个API函数都可以实现这些功能,但是在大多数情况下She ...
- Latex感想
看人家,一个小女生,被导师逼着,首先对电脑方面理解不多,3天时间,latex已经把Paper框架建立起来,我可以说我自愧不如吗?德鲁克<卓有成效的管理者>说的一次干一件事情,<冬吴相 ...
- Partitioning & Archiving tables in SQL Server (Part 1: The basics)
Reference: http://blogs.msdn.com/b/felixmar/archive/2011/02/14/partitioning-amp-archiving-tables-in- ...
- HTML 浏览器显示控制
//强制浏览器以最高版本运行页面 <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" ...
- ACM知识点
基础算法 高精 模拟 分治 贪心 排序 DFS 迭代加深搜索 BFS 双向BFS 动态规划 DAG上DP 树上DP 线性DP 图算法 最短路 FLYD DJATL BF 最大流 Dinic ISAP ...
- Salesforce 使用Js 调用Webservice实例
1,创建 Custom Button 在页面上 2, 创建CustomJs 代码调用Webservice <!--参数名区分大小写,对于跨层object直接在Object名后直接加参字段名即可- ...
- 解决sublime3 package control显示There are no packages available for installation
之前一直是在windows上使用sublime,由于公司内部搭建了服务器,干脆把所有项目搬到了服务器上,自然也装上了牛逼闪闪的sublime,然而在接下来安装插件的时候却出了问题,package co ...
- re正则表达式
1.matchimport rem = re.match("[0-9]{0,10}","7564565abcdefg") #match从开头开始匹配if m: ...