题目描述

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 题的更多相关文章

  1. 北邮oj 104. 912星球的研究生

    104. 912星球的研究生 时间限制 1000 ms 内存限制 65536 KB 题目描述 最近912星球的研究生入学了,912星球的教务处因此忙的焦头烂额,要求yzr做一个信息管理系统登陆查询研究 ...

  2. 北邮oj 97. 二叉排序树

    97. 二叉排序树 时间限制 1000 ms 内存限制 65536 KB 题目描述 二叉排序树,也称为二叉查找树.可以是一颗空树,也可以是一颗具有如下特性的非空二叉树: 若左子树非空,则左子树上所有节 ...

  3. 北邮OJ

    90. 字符串转换 时间限制 1000 ms 内存限制 65536 KB 题目描述 我们将仅由若干个同一小写字母构成的字符串称之为简单串,例如"aaaa"是一个简单串,而" ...

  4. 【经验总结】北邮OJ

    90. 字符串转换 时间限制 1000 ms 内存限制 65536 KB 题目描述 我们将仅由若干个同一小写字母构成的字符串称之为简单串,例如"aaaa"是一个简单串,而" ...

  5. 北邮OJ 89. 统计时间间隔 java版

    89. 统计时间间隔 时间限制 1000 ms 内存限制 65536 KB 题目描述 给出两个时间(24小时制),求第一个时间至少要经过多久才能到达第二个时间.给出的时间一定满足的形式,其中x和y分别 ...

  6. 用PHP语言刷OJ题

    平常在学校都是用C,C++,Java来刷OJ题,把AC的题用不同的语言再AC一次,基本相当于翻译而已.看到学校的OJ支持提交PHP代码,于是尝试了一下. 首先,得会使用PHP,但是你如果在看这篇博客, ...

  7. 北邮14&18年软院机试【参考】答案

    2014 Problem A. 奇偶求和 题目描述: 给定N个数,分别求出这N个数中奇数的和以及偶数的和. 输入格式 第一行为测试数据的组数T(1<=T<=50).请注意,任意两组测试数据 ...

  8. 中国石油大学(华东)OJ题目的HTML爬取

    这几天刷华东OJ的题,写博客还要复制HTML的代码,感觉麻烦的一批,然后就去摸鱼写了个小爬虫.. 看一下运行效果吧- 输入详细的pid.cid或id即可爬取相应的html代码 一些注意要点: 关键的还 ...

  9. 北邮新生排位赛1解题报告a-c

    <div class="page-header" style="padding-bottom: 9px; margin: 20px 0px 30px; border ...

随机推荐

  1. 因为此控件已在 web.config 中注册并且与该页位于同一个目录中

    在web.config文件配置了用户控件 <pages> <controls> <add tagPrefix="my" tagName="l ...

  2. Google Developing for Android 一 - 相关上下文介绍

    前几天在G+上看到Google Developers站点,有一个Android系列的文章,分享到个人微博,周末闲来没事就学写了下,把它们简单的翻译了下,没想到一发不可收拾,六篇文章全部都翻译完了,有些 ...

  3. 更改yum源地址

    1.进入yum配置文件目录:cd /etc/yum.repos.d/ 2.备份配置文件:mv CentOS-Base.repo CentOS-Base.repo.bak 3.下载网易的配置,改成网易的 ...

  4. (整理)C#基础知识_泛型的实现

    本文是截取自MSDN的文章部分,方便自己查看,原文地址:https://msdn.microsoft.com/zh-cn/library/ms379564(VS.80).aspx 泛型实现 表面上,C ...

  5. js疑问

    var arr = ['A', 'B', 'C', 'D', 'E', 'F', 'G'];var aCopy = arr.slice();aCopy; // ['A', 'B', 'C', 'D', ...

  6. 外壳exe通过反射调用dll时

    外壳exe通过反射调用dll时,dll是 4.0的框架,外壳exe也需要编译成4.0的框架,如果dll本身有调用32位的dll,那么外壳exe也需要编译成32位. 调试时报的那个错,直接继续运行,不影 ...

  7. JS-改变页面的颜色之变化核心-获取六位的随机数

    前言:从JS-改变页面的颜色(一).JS-改变页面的颜色(二).JS-改变页面的颜色(三)三个简单的小白例,我们可以轻而易举的看到起变化的核心是——十六进制颜色值的获取方式,所以,我们这里总结一下获取 ...

  8. cpio命令用法

    [转自]流浪妖精のSKY    http://www.cnitblog.com/flutist1225/articles/18974.html cpio命令用法 cpio命令     利用cpio 可 ...

  9. MacOS changed System Integrity Protection status

    禁止 System Integrity Protection 按住 command + R 重启系统 进入单用户模式 启动bash工具: 输入: csrutil disable 输入:reboot 启 ...

  10. C语言Notebook

    int *pointer=NULL    /*指针变量一定要赋初值*/pritnf("Pointer' address is:%p",&pointer);  /*打印指针变 ...