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. 压缩图片C#算法

    转载自 http://www.open-open.com/lib/view/open1391348644910.html using System.IO; using System.Drawing; ...

  2. thread.h

    https://github.com/wookayin/pintos/blob/master/src/threads/thread.h #ifndef THREADS_THREAD_H   #defi ...

  3. asp.net core 与EFcore 入门

    什么是EFcore? Entity Framework (EF) Core 是轻量化.可扩展和跨平台版的常用 Entity Framework 数据访问技术,EF Core 可用作对象关系映射程序 ( ...

  4. sql 技巧

    1.想把一张表的 某个字段或多个字段 的 所有数据 复制到另外一张表里  insert into 表名(字段) select (字段) from 表名 2.from Users u , IN(u.ro ...

  5. 【python爬虫和正则表达式】爬取表格中的的二级链接

    开始进公司实习的一个任务是整理一个网页页面上二级链接的内容整理到EXCEL中,这项工作把我头都搞大了,整理了好几天,实习生就是端茶送水的.前段时间学了爬虫,于是我想能不能用python写一个爬虫一个个 ...

  6. CodeForces 445E DZY Loves Colors

    DZY Loves Colors Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces ...

  7. Camera Calibration 相机标定:Opencv应用方法

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/49427383 Opencv中Camer ...

  8. Qt之OpenSSL

    简述 OpenSSL是一个强大的安全套接字层密码库,囊括主要的密码算法.常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用. 简述 下载安装 使用 更多参考 下载安装 ...

  9. nginx php No input file specified 怎样处理?

    配置nginx支持php 出现了No input file specified ? 仅仅要改动下安装文件夹下的  nginx.conf下的 location ~ \.php$ {           ...

  10. Material Design学习之 Button(具体分析,传说中的水滴动画)

    转载请注明出处:王亟亟的大牛之路 上一篇大致介绍了Material Design的一些基本概念传送门:http://blog.csdn.net/ddwhan0123/article/details/5 ...