北邮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 ...
随机推荐
- [PAT]素因子分解(20)
#include "stdio.h" #include "math.h" long Prime(long); long PrimeCount(long,long ...
- SSH in Python
需要安装paramiko,paramiko需要PyCrypto , PyCrypto 需要GCC编译. 安装PyCrypto: 安装Mingw32,确认环境变量. 下载并编译PyCrypto - se ...
- ubuntu12.04 安装mac主题
1.下载主题包我把主题上传到了csdn的资源栏目,下载地址:http://download.csdn.net/detail/chenjiebin/4531537 2.将/mac/sharc/theme ...
- adb shell出错“error: unknown host service”
已经测试,可用: 在命令行输入adb shell后输出如下错误: adb server is out of date. killing... ADB server didn't ACK * fail ...
- EF初级入门 (一对多、多对多)
1.创建新项目并引入Entity Framework 然后就可以开始使用EF了 开始使用一对多 Users 用户类,UserDetail用户详情类:一个用户对应多个详情(仅用于测试) public c ...
- Robotium怎样判断测试结果
Robotium判断测试结果的方法主要有三类:assert.is.search.assert方法除了Robotium API,还有Junit中的所有断言方法,Junit的断言方法下篇详解. void ...
- oozie调用shell
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agree ...
- ContentProvider小结
1.什么情况下需要使用ContentProvider 跨进程提供数据访问的接口,如果在同一个App下,没有必要使用此种方式 2.自定义ContentProvider public class MyCo ...
- [react native] react-native-tab-navigator在子Component中隐藏
因为文档只列出了TabBarIOS, 不支持Android,所以github上找到这个组件. 先说下我的页面构造: 入口文件 —> 注册组件(包含Navigator, 跳转到欢迎页)—> ...
- jQuery 插件基础
jQuery 插件基础 翻译 How to Create a Basic Plugin 如果你需要在 jQuery 选择器上执行一系列重复操作, 这时候你需要编写 jQuery 插件. jQuery ...