zoj3839-Poker Face
#include<cstdio>
int n;
void P(int i,int j,int n,int f){
if(i==n){
for(int k=1;k<=n;k++)printf("*");
if(!f) puts("");
}
else if(i==1){
for(int k=1;k<=n;k++)printf("*");
if(!f){puts("");
P(i+1,1,n,f);}
else printf("*");
}
else if(i==n/8+1||i==n/4+n/8+1){
printf("*");
for(int k=2;k<n/8+1;k++)printf(" ");
for(int k=n/8+1;k<n/4+n/8+1;k++)printf("*");
for(int k=n/4+n/8+1;k<n/8+n/2+1;k++)printf(" ");
for(int k=n/8+n/2+1;k<=3*n/4+n/8;k++)printf("*");
for(int k=3*n/4+n/8+1;k<n;k++)printf(" ");
if(!f){puts("*");
// (j>n/8+1&&j<n/4+n/8||j>n/8+n/2+1&&j<n/8+3*n/4)
P(i+1,1,n,f);}
else printf("*");
}
else if(i>n/8+1&&i<n/4+n/8+1){
printf("*");
for(int k=2;k<n/8+1;k++)printf(" ");printf("*");
for(int k=n/8+2;k<n/4+n/8;k++)printf(" ");printf("*");
for(int k=n/4+n/8+1;k<n/8+n/2+1;k++)printf(" ");printf("*");
for(int k=n/8+n/2+2;k<3*n/4+n/8;k++)printf(" ");printf("*");
for(int k=3*n/4+n/8+1;k<n;k++)printf(" ");
if(!f){
puts("*");
// (j>n/8+1&&j<n/4+n/8||j>n/8+n/2+1&&j<n/8+3*n/4)
P(i+1,1,n,f);}
else printf("*");
}
// else if(i>=n/8+1&&i<=n/8+n/4+1&&(j==n/8+1||j==n/8+n/4||j==n/8+n/2+1||j==n/8+3*n/4))printf("*"),P(i,j+1,n);
else if(i==n/2+1){
printf("*");
for(int k=2;k<n/4+1;k++)printf(" ");
for(int k=n/4+1;k<=n-n/4;k++)printf("*");
for(int k=n-n/4+1;k<n;k++)printf(" ");
if(!f){puts("*");
P(i+1,1,n,f);}
else printf("*");
}
else if(i>n/2+1&&i<n){
if(n==8){
if(i==5)printf("* **** *");
else printf("* * * *");
if(!f){puts("");
P(i+1,1,n,f);}
}
//if(j>=n/4+1&&j<=n-n/4)printf("*"),P(i,j+1,n);
else {
printf("*");
for(int k=2;k<n/4+1;k++)printf(" ");
P(n-i+1,1,n/2,1);
for(int k=n-n/4+1;k<n;k++)printf(" ");
if(!f){puts("*");
P(i+1,1,n,0); }
else printf("*");
}
}
else {
printf("*");
for(int k=2;k<=n-1;k++)printf(" ");
if(!f){puts("*");
P(i+1,1,n,f);}
else printf("*");
}
return ;
}
int main(){
while(scanf("%d",&n)&&n>=8){
P(1,1,n,0);
puts("");
}
}
zoj3839-Poker Face的更多相关文章
- uva131 The Psychic Poker Player
The Psychic Poker Player Time Limit: 3000MS 64bit IO Format: %lld & %llu Description In 5-ca ...
- UVa12298 Super Poker II(母函数 + FFT)
题目 Source http://acm.hust.edu.cn/vjudge/problem/23590 Description I have a set of super poker cards, ...
- HDU 4759 Poker Shuffle
Poker Shuffle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 2)C. Bear and Poker
C. Bear and Poker ...
- ZOJ 1111 Poker Hands
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1111 A poker hand consists of 5 ca ...
- Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 1) A. Bear and Poker 分解
A. Bear and Poker Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/573/pro ...
- ZOJ1111:Poker Hands(模拟题)
A poker deck contains 52 cards - each card has a suit which is one of clubs, diamonds, hearts, or sp ...
- 如何生成一副Poker
import java.util.LinkedList;import java.util.Random;//扑克类class Poker{ String color;//花色 String ...
- bzoj2487: Super Poker II
Description I have a set of super poker cards, consisting of an infinite number of cards. For each p ...
- One Card Poker
qsc oj 题目 提交 比赛 小组 排名 帮助 Mactavish 题目 我的提交 One Card Poker 发布时间: 2017年2月14日 14:02 最后更新: 2017年2月14日 ...
随机推荐
- 使用doxygen生成注释文档
1. doxygen下载地址:http://www.stack.nl/~dimitri/doxygen/ 2. 参考http://wenku.baidu.com/link?url=ETvBUyaR9f ...
- VS2010编译libjpeg
环境:win7旗舰版 x64 VS2010 下载源代码下载地址:http://www.ijg.org/,选择windows format file 解压源代码,修改源代码中jconfig.vc为jco ...
- UVa 10029 hash + dp
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- Distinct Substrings - spoj 694(不重复子串个数)
题目大意:RT 分析:练手题目....后缀数组确实很强大.....多理解height数组, 切勿使用模版,后缀数组本身就有很多细节,多犯错更有利理解这个算法. 代码如下: ========== ...
- sonarQube Scanner
到现在为止,已经将sonarQube服务器搭建好,服务器是Linux服务器,基于sonarQube6.1配置的 原理关于sonarQube的工作原理,暂时还不是太清楚,据同事的分析,是在本机调用服务器 ...
- 我眼中的 Oracle 性能优化
恒生技术之眼 作者 林景忠 大家对于一个业务系统的运行关心有如下几个方面:功能性.稳定性.效率.安全性.而一个系统的性能有包含了网络性能.应用性能.中间件性能.数据库性能等等. 今天从数据库性能的角度 ...
- U3D C# 实现AS3事件机制
写了很多年的AS3,最近接触U3D感觉事件机制没AS3的爽.咬紧牙关一鼓作气 基于C# 的委托实现了一版.废话不多说上干货. EventDispatcher代码如下: using UnityEngin ...
- Linux命令 — 设置或查看网络配置命令ifconfig
ifconfig命令用于设置或查看网络配置,包括IP地址.网络掩码.广播地址等.它是linux系统中,使用频率最高的关于网络方面的命令. 1. 命令介绍 命令格式: ifconfig [interfa ...
- java基础之 IO流
javaIO流 IO流 : (input output) 输入输出流 :输入 :将文件读到内存中 输出:将文件从内存输出到其他地方. IO技术的作用:主要就是解决设备和设备之间的数据传输问题 ...
- [React] Intro to inline styles in React components
React lets you use "inline styles" to style your components; inline styles in React are ju ...