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

  1. ZOJ Monthly, November 2014

    做了一次月赛,没想到这么难,加上后来补上的题目也只有3个题.第一名也只有4个题啊啊啊啊~.其中两道还是水题.留坑慢慢补上来. 3832 Tilt Cylinder 给定如图所示有盖圆柱体,R,H,水面 ...

  2. 浙大月赛ZOJ Monthly, August 2014

    Abs Problem Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Alice and Bob is playing a ga ...

  3. 135 - ZOJ Monthly, August 2014

    135 - ZOJ Monthly, August 2014 A:构造问题,推断序列奇偶性.非常easy发现最小值不是1就是0.最大值不是n就是n - 1,注意细节去构造就可以 E:dp.dp[i][ ...

  4. ZOJ Monthly, November 2012

    A.ZOJ 3666 Alice and Bob 组合博弈,SG函数应用 #include<vector> #include<cstdio> #include<cstri ...

  5. ZOJ Monthly, August 2014

    A Abs Problem http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5330 找规律题,构造出解.copyright@ts ...

  6. ZOJ Monthly, June 2014 月赛BCDEFGH题题解

    比赛链接:点击打开链接 上来先搞了f.c,,然后发现状态不正确,一下午都是脑洞大开,, 无脑wa,无脑ce...一样的错犯2次.. 硬着头皮搞了几发,最后20分钟码了一下G,不知道为什么把1直接当成不 ...

  7. 记次浙大月赛 134 - ZOJ Monthly, June 2014

    链接 虽做出的很少,也记录下来,留着以后来补..浙大题目质量还是很高的 B 并查集的一些操作,同类和不同类我是根据到根节点距离的奇偶判断的,删点是直接新加一个点,记得福大月赛也做过类似的,并差集的这类 ...

  8. ZOJ Monthly, June 2014 解题报告

    A.Another Recurrence Sequence problemId=5287">B.Gears 题目大意:有n个齿轮,一開始各自为一组.之后进行m次操作,包含下面4种类型: ...

  9. ZOJ 4010 Neighboring Characters(ZOJ Monthly, March 2018 Problem G,字符串匹配)

    题目链接  ZOJ Monthly, March 2018 Problem G 题意  给定一个字符串.现在求一个下标范围$[0, n - 1]$的$01$序列$f$.$f[x] = 1$表示存在一种 ...

随机推荐

  1. <%=%>、<%%>、<%@%>、<%#%>的区别

    1.<%= %> 里面放变量名,获取后台的变量值,直接输入变量到页面上,里面放的变量名,未经过encode eg: 后台: seession["ab"]=ab; 前台: ...

  2. swift where 的作用

    条件限定: 类型限定: 结构化查询模式. 用于结构体.记录字段.

  3. (转载)比较web ui 框架

    以下是几个精致的web UI框架 1.Aliceui Aliceui是支付宝的样式解决方案,是一套精选的基于 spm 生态圈的样式模块集合,是 Arale 的子集,也是一套模块化的样式命名和组织规范, ...

  4. Java线程之Java内存模型(jmm)

    一.Java内存模型(jmm) 线程通信 消息传递 重排序 顺序一致性 Happens-Before As-If-Serial

  5. canvas 连线曲线图封装

    $.fn.hChart=function (opt) { var setting=$.extend({ className:'', data:[] },opt); var tbody=this; va ...

  6. BZOJ 3790 神奇项链(回文自动机+线段树优化DP)

    我们预处理出来以i为结尾的最长回文后缀(回文自动机的构建过程中就可以求出)然后就是一个区间覆盖,因为我懒得写贪心,就写了线段树优化的DP. #include<iostream> #incl ...

  7. luogu P3765 总统选举(线段树维护摩尔投票+平衡树)

    这题需要一个黑科技--摩尔投票.这是一个什么东西?一个神奇的方法求一个序列中出现次数大于长度一半的数. 简而言之就是同加异减: 比如有一个代表投票结果的序列. \[[1,2,1,1,2,1,1]\] ...

  8. Java基础学习总结(7)——Object类

    一.Object类介绍 Object类在JAVA里面是一个比较特殊的类,JAVA只支持单继承,子类只能从一个父类来继承,如果父类又是从另外一个父类继承过来,那他也只能有一个父类,父类再有父类,那也只能 ...

  9. HDU——T 2444 The Accomodation of Students

    http://acm.hdu.edu.cn/showproblem.php?pid=2444 Time Limit: 5000/1000 MS (Java/Others)    Memory Limi ...

  10. oracle新手随记10

    1. unpivot注意点:select new_col from (select ename,job,to_char(sal) as sal,null as c from emp)         ...