囧字构造 模拟
来源:互联网 发布:renee数据恢复 编辑:程序博客网 时间:2024/06/09 22:42
https://vjudge.net/problem/HRBUST-2085
需要注意的是二维数组里,x坐标和y坐标的关系。
其次是先构造外边框,再构造内部,这样可以省去重复构造的步骤。(迭代)
#include<iostream>#include<cstdio>#include<string.h>#include<math.h>#include<string>#include<map>#include<set>#include<vector>#include<algorithm>#include<queue>#include<iomanip>using namespace std;const int INF = 0x3f3f3f3f;const int NINF = 0xc0c0c0c0;char maze[1000][1000];void draw(int n , int x , int y){ int tlen = ( 1 <<(n+2) ); for(int i=y;i<tlen+y;i+=tlen-1){ for(int j=x;j<tlen+x;j+=tlen-1){ maze[i][j] = '+'; } for(int k=x+1;k<tlen+x-1;k++){ maze[i][k] = '-'; } } for(int i=y+1;i<tlen+y-1;i++){ for(int j=x;j<tlen+x;j+=tlen-1){ maze[i][j] = '|'; } } if(n==0) return ; for(int i=2;i<tlen/2-1;i++){ maze[y+i][x+tlen/2-i] = '/'; maze[y+i][x+tlen/2+i-1] = '\\'; } draw(n-1,x+tlen/4,y+tlen/2);}int main(){ int T; cin >> T; int len; while(T--){ int n; cin >> n; len = ( 1 << (n+2)); memset(maze,' ',sizeof(maze)); draw(n,0,0); for(int i=0;i<len;i++){ for(int j=0;j<len;j++){ putchar(maze[i][j]); } putchar(10); } }}
0 0
- 囧字构造 模拟
- 模拟虚拟构造函数
- hdoj5402 【模拟/构造】
- Http 模拟构造提交
- powermock 模拟构造函数
- [NOIP2017模拟]构造
- curl 构造 模拟 post请求
- Codeforces 174B【模拟构造】
- poj1068_(构造法/模拟法)
- ZOJ1633-构造模拟-Big String
- C++中模拟C#静态构造函数
- C++构造函数和模拟AfxGetApp()
- (pojstep1.3.1)1017(构造法模拟)
- (poj1.3.2)1791(构造法模拟)
- POJ 2000(构造法模拟)
- ruby模拟多个构造器
- ZOJ 1633 Big String(模拟构造)
- POJ 1017 Packets(构造模拟)
- 【BFS】(一)抓住那头牛(poj 3278)
- Java IO流之【缓冲流和文件流复制文件对比】
- 湖南省第八届省赛,最小生成树Prim算法+利用二进制的状态枚举
- JVM学习笔记(八)类加载机制-类加载器
- 博客地址
- 囧字构造 模拟
- JVM源码分析之FinalReference完全解读
- 多线程之 synchronized 和 volatile
- Java反射八 数组
- Unreal Open Day 2017 参会总结——ACT(动作)游戏制作经验分享
- angular2权威教程(中文版)(ng-book2)
- 什么是Ajax?
- DP——Luogu1437 [HNOI2004]敲砖块
- java.lang.ClassNotFoundException: org.springframework.aop.TargetSource