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. hiho1469 - 简单dp

    题目链接 题目大意: 从一个大正方形数组里面找一个小正方形,满足其中的每个位置上的数都恰好比他的左边的那个和上边的那个大1(如果左边或上边的那个不存在的话就无此要求). 比如 1 2 32 3 43 ...

  2. POJ 1664 放苹果【DFS】

    题意:给出n个苹果,m个盘子,问有多少种不同的苹果放置方法 可以把它抽象为把一个数n,拆分成a1,a2,a3,---,am,使得它们的和为n, 话说这一题是学习的ppt里面的,它的思路就是搜索 搜索条 ...

  3. 优动漫PAINT个人版绘制树叶教程

    超详细树叶绘制法,更有配套绘树小TIPE!让你画树So Easy~一秒变身,画树达人! 优动漫PAINT个人版软件下载:http://www.dongmansoft.com/chanpin.html ...

  4. SQL 自动记录存储过程,表,函数的创建修改和删除 -相当于SVN一样

         在项目开发过程中,项目管理者通常都很希望对项目的开发进展有一个日志的记录.代码的记录和管理可以通过TFS或者VSS等工具去管理.但是数据库却没有记录开发日志这一功能.这在实际开发中很不方便, ...

  5. 洛谷P3369 【模板】普通平衡树 01trie/骚操作

    Code: #include <cstdio> #include <algorithm> #include <cstring> #define setIO(s) f ...

  6. js 将数组中的每一项安装奇偶重新组合成一个数组对象

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. [NOI2014]动物园(KMP)

    题意 题解 因为,一直用j=nxt[j]来遍历,可以遍历前i个字符所有相等的前后缀长度,所以有一个暴力的想法,就是对于每一个长度,开始遍历,记录长度小于i/2的相等的前后缀数量,最后累加即可. 但显然 ...

  8. java compare 时间排序

    所有数据存进resultList中 Collections.sort(resultList, new Comparator<HashMap<String, Object>>() ...

  9. 紫书 例题8-17 UVa 1609 (构造法)(详细注释)

    这道题用构造法, 就是自己依据题目想出一种可以得到解的方法, 没有什么规律可言, 只能根据题目本身来思考. 这道题的构造法比较复杂, 不知道刘汝佳是怎么想出来的, 我想的话肯定想不到. 具体思路紫书上 ...

  10. 实验了一下对于struct引用的成员的改动

    今天写代码的时候,不确定struct用引用传递给函数的时候,他的成员在函数里面改变的时候,是否能影响到外面. 实验了一下 #include <stdio.h> #include <s ...