北邮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 ...
随机推荐
- 部署web应用
package it.cast.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servle ...
- .Net中的泛型(where T : class的含义)
Eg: class A<T>where T:new() where表明了对类型变量T的约束关系.where T: A表示类型变量是继承于A的,或者是A本身.where T:new()指明了 ...
- Modelsim-altera 仿真 顶层原理图的解决办法
解决办法:首先需要将.bdf原理图文件转换为Verilog HDL等第三方EDA工具所支持的标准描述文件.在Quartus下,保持*.bdf为活动窗口状态,运行[File]/[Create/Updat ...
- 未能加载文件或程序集“Microsoft.SQLServer.DTSRuntimeWrap”或它的某一个依赖项。试图加载格式不正确的程序。
只要将应用程序池中的是否启用32位应用程序改为支持就可以了
- .NET程序集的编译目标平台:X86 &AnyCPU &X64
在我们测试平台上发布客户端组件,经常会碰到因为build的版本是x86还是anycpu而引起的application error的问题.借此,研究了一下X86,X64,AnyCPU的区别. 使用.ne ...
- (转)You might not need jQuery
You might not need jQuery You certainly can support IE 9 and below without jQuery, but we don't. Ple ...
- Oracle诡异结果调查备忘 - A investigation memo of weird Oracle database search results
最近需要维护一个差不多十多年前开发的ASP.Net程序,遇到了各种奇奇怪怪的问题,把其中比较难查明的问题记录如下: 问题一: 同样的SQL查询在不同服务器上查询结果不同.在QA环境下,结果完全正常,而 ...
- Docker Day1 & 2
1. Docker Basic 安装docker(在/etc/selinux/config文件中设置selinux=disabled,否则安装时会报错) curl -ssL http://get.do ...
- c++ 打印堆栈代码
namespace google {namespace glog_internal_namespace_ {void DumpStackTraceToString(std::string* stack ...
- 监听JVM的几个命令(可用于linux 本机)
1. jstat 这个命令对于查看Jvm的堆栈信息很有用.能够查看eden,survivor,old,perm等heap的capacity,utility信息 对于查看系统是不是有能存泄漏以及参数设置 ...