北邮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 ...
随机推荐
- Xcode 7 调试野指针利器 Address sanitizer
Xcode 7 调试野指针利器 Address sanitizer 什么是Address Sanitizer? AddressSanitizer is a fast memory error dete ...
- 使用Maven加载项目有Dubbo框架时出现的常见异常情况
异常描述: The matching wildcard is strict, but no declaration can be found for element 'dubbo ...
- Android UI 绘制过程浅析(四)draw过程
前言 draw是绘制View三个步骤中的最后一步.同measure.layout一样,通常不对draw本身进行重写,draw内部会调用onDraw方法,子类View需要重写onDraw(Canvas) ...
- View Controller Relationships
Parent-child relationshipsParent-child relationships are formed when using view controller container ...
- php服务生成exe附件下载
<?php $realname = "zhuast.exe"; //原始文件名 $filename = "中文 文件名.exe"; //下载到浏览器的文件 ...
- Oracle系统学习摘要
对于企业级大型系统,Oracle数据库的重要性不言而喻,作为长期使用Sql server的developer,花了点时间学习了一个Oracle的系列课程,总结一下. 1.oracle一些基础命令 sq ...
- adb server无法终止问题
这两天通过python去连接Android手机时,一直提示:Adb connection Error:An existing connection was forcibly closed by the ...
- js 判断IOS版本号
先来观察 iOS 的 User-Agent 串: Phone 4.3.2 系统:Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; e ...
- DapperExtensions的基本用法
介绍下使用Dapper-Extensions的基本语法 //实体类 DemoEntity entity = new DemoEntity(); //根据实体主键删除 this.Delete<De ...
- GET与POST的区别
转自http://blog.csdn.net/darxin/article/details/4944225#comments HTTP请求的GET与POST方式的本质区别可以参考hyddd在<浅 ...