137 - ZOJ Monthly, November 2014 - J Poker Face
Poker Face
Time Limit: 2 Seconds Memory Limit: 65536 KB
As is known to all, coders are lack of exercise and Kato is one of them. In order to get fit, he decides to go mining in MINECRAFT. However, it is always dangerous in the mine because there are a lot of ZOMBIEs in MINECRAFT. They kill Kato time and time again when he is mining. But this time, Kato is in invincible mode and wants to observe what the ZOMBIEs' faces are like. After his obervation, he found that the ZOMBIEs' faces are regular. Now he provides you the ZOMBIEs' faces of size 8, 16 and 32, it is your task to draw the other ZOMBIEs. You should find the recursivepattern from the small cases and learn to draw bigger cases.
Input
There are multiple test cases. For each case there is only a number N (8 ≤ N≤ 1024, N is a power of 2), which is size of the ZOMBIE's face. The input ends with an integer less than eight.
Output
For each case, output the image of the ZOMBIE's face. And print an empty line after each case.
Sample Input
8
16
32
0
Sample Output
********
*** ***
*** ***
*** ***
* **** *
* * * *
* * * *
******** ****************
* *
* **** **** *
* * * * * *
* * * * * *
* * * * * *
* **** **** *
* *
* ******** *
* * * * * *
* * * * * *
* * **** * *
* *** *** *
* *** *** *
* *** *** *
**************** ********************************
* *
* *
* *
* ******** ******** *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* ******** ******** *
* *
* *
* *
* **************** *
* * *** *** * *
* * *** *** * *
* * *** *** * *
* * * **** * * *
* * * * * * * *
* * * * * * * *
* * ******** * *
* * * *
* * **** **** * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * **** **** * *
* * * *
********************************
Hint
The sample out put is the ZOMBIE's face of size 8, 16, 32.
Author: ZHU, Heming
解题:递推打印就是了。。。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <cstdlib>
#include <string>
#include <set>
#include <stack>
#define LL long long
#define INF 0x3f3f3f3f
#define pii pair<int,int>
using namespace std;
const int maxn = ;
int n;
char table[][maxn][maxn];
void printLine(int m,int n,int x,int y) {
for(int i = ; i < n; ++i)
table[m][x][y+i] = '*';
}
void printR(int m,int n,int x,int y) {
for(int i = ; i < n-; ++i) {
table[m][x+i][y] = '*';
for(int j = ; j < n-; ++j)
table[m][x+i][y+j] = ' ';
table[m][x+i][y+n-] = '*';
}
}
void printG(int m,int n) {
for(int i = ; i < n; ++i) {
for(int j = ; j < n; ++j)
putchar(table[m][i][j]);
putchar('\n');
}
}
void printB(int n,int x,int y,int m) {
for(int i = n-; i >= ; --i) {
for(int j = ; j < n; ++j) {
table[m][x+i][y+j] = table[m-][i][j];
}
}
}
void draw(int m,int n) {
printLine(m,n,,);
printR(m,n,,);
printLine(m,n,n-,); printLine(m,n>>,n>>,n>>);
printR(m,n>>,(n>>)+,n>>);
printLine(m,n>>,(n>>)+(n>>),n>>); printLine(m,n>>,n>>,n-(n>>)-(n>>));
printR(m,n>>,(n>>)+,n-(n>>)-(n>>));
printLine(m,n>>,(n>>)+(n>>),n-(n>>)-(n>>));
}
void draw2(int m,int n) {
int y = n>>;
int x = (n>>);
for(int i = (n>>)-; i >= ; --i,x++) {
for(int j = ; j < (n>>); ++j)
table[m][x][y+j] = table[m-][i][j];
}
}
int main() {
memset(table,' ',sizeof(table));
draw(,<<);
printLine(,,,);
table[][][] = table[][][] = '*';
table[][][] = table[][][] = '*';
for(int i = ; i <= ; ++i) {
draw(i,<<i);
draw2(i,<<i);
}
while(scanf("%d",&n),n >= ) {
int k = log2(n)+0.5;
printG(k,n);
putchar('\n');
}
return ;
}
137 - ZOJ Monthly, November 2014 - J Poker Face的更多相关文章
- ZOJ Monthly, November 2014
做了一次月赛,没想到这么难,加上后来补上的题目也只有3个题.第一名也只有4个题啊啊啊啊~.其中两道还是水题.留坑慢慢补上来. 3832 Tilt Cylinder 给定如图所示有盖圆柱体,R,H,水面 ...
- 浙大月赛ZOJ Monthly, August 2014
Abs Problem Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Alice and Bob is playing a ga ...
- 135 - ZOJ Monthly, August 2014
135 - ZOJ Monthly, August 2014 A:构造问题,推断序列奇偶性.非常easy发现最小值不是1就是0.最大值不是n就是n - 1,注意细节去构造就可以 E:dp.dp[i][ ...
- ZOJ Monthly, November 2012
A.ZOJ 3666 Alice and Bob 组合博弈,SG函数应用 #include<vector> #include<cstdio> #include<cstri ...
- ZOJ Monthly, August 2014
A Abs Problem http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5330 找规律题,构造出解.copyright@ts ...
- ZOJ Monthly, June 2014 月赛BCDEFGH题题解
比赛链接:点击打开链接 上来先搞了f.c,,然后发现状态不正确,一下午都是脑洞大开,, 无脑wa,无脑ce...一样的错犯2次.. 硬着头皮搞了几发,最后20分钟码了一下G,不知道为什么把1直接当成不 ...
- 记次浙大月赛 134 - ZOJ Monthly, June 2014
链接 虽做出的很少,也记录下来,留着以后来补..浙大题目质量还是很高的 B 并查集的一些操作,同类和不同类我是根据到根节点距离的奇偶判断的,删点是直接新加一个点,记得福大月赛也做过类似的,并差集的这类 ...
- ZOJ Monthly, June 2014 解题报告
A.Another Recurrence Sequence problemId=5287">B.Gears 题目大意:有n个齿轮,一開始各自为一组.之后进行m次操作,包含下面4种类型: ...
- ZOJ 4010 Neighboring Characters(ZOJ Monthly, March 2018 Problem G,字符串匹配)
题目链接 ZOJ Monthly, March 2018 Problem G 题意 给定一个字符串.现在求一个下标范围$[0, n - 1]$的$01$序列$f$.$f[x] = 1$表示存在一种 ...
随机推荐
- springmvc两种非注解的处理器适配器
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http:// ...
- STM8S103 STVD编译空间不足
关于text空间(理解为代码空间)不足问题 # 关于.bsct和.ubsct问题(着重参考http://www.waveshare.net/article/STM8-3-1-10.htm) map文件 ...
- vue路由跳转传参
this.$router.push({ path: '/message/result_notice', query: { id: id } }) // let type = this.$route.n ...
- 被我忽略许久的set
心塞,set一直是我忽略的一个数据结构 1.生成一个set: 1) set(iterable) 传入一个可以迭代的数据结构: eg:字符串;元组;列表,字典 2) {v1,v2,.......,vn} ...
- keepalive安装配置
安装 Centos7.4 yum install keepalived 配置 Master服务器配置 [root@wsjy-proxy01 keepalived]# cat keepalived.co ...
- java jar打包命令使用
用法:jar {ctxu}[vfm0Mi] [jar-文件] [manifest-文件] [-C 目录] 文件名 ... 选项: -c 创建新的存档 -t 列出存档内容的列表 -x 展开存档中的命名的 ...
- c++常见操作的模板
1.统计时间 #include<ctime> clock_t startTime = clock(); code(); clock_t endTime = clock(); cout &l ...
- Unity 制作安装程序和卸载程序
1.最简单的方式通过winrar制作 但是做出来的页面好low的感觉 参考链接:https://www.cnblogs.com/fetty/p/5185913.html 2.通过inno制作安装程序: ...
- grep的使用【转】
grep的作用是显示匹配一个或多个模式的文本行.时常会作为管道(|)的第一步,以便对匹配的数据作进一步处理.grep常用于查找和替换文本的.在传统上,grep有3个版本:grep.egrep(扩展gr ...
- 泛泰 A850 4.1.2 刷第三方专用Recovery合集
下载 http://download.csdn.net/detail/benjaminwan/7406089 专用于刷基于AOSP4.1.2的乐蛙和MIUIV5 由于本人制作的第三方ROM,为了通刷, ...