题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6330

题目:

题意:给你长宽高,让你画出一个正方体。

思路:模拟即可,湘潭邀请赛热身赛原题,不过比那个容易很多,湘潭那个没写==,这个模拟还是很难受的,写了好久……

代码实现如下:

 #include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std; typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;;
typedef pair<int, int> pii;
typedef unsigned long long ull; #define lson i<<1
#define rson i<<1|1
#define bug printf("*********\n");
#define FIN freopen("D://code//in.txt", "r", stdin);
#define debug(x) cout<<"["<<x<<"]" <<endl;
#define IO ios::sync_with_stdio(false),cin.tie(0); const double eps = 1e-;
const int mod = ;
const int maxn = + ;
const double pi = acos(-);
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f; int t, a, b, c, n, m;
char mp[maxn][maxn]; int main() {
//FIN;
scanf("%d", &t);
while(t--) {
scanf("%d%d%d", &a, &b, &c);
n = * c + + * b;
m = * a + + * b;
//初始化
for(int i = ; i <= n; i++) {
for(int j = ; j <= m; j++) {
mp[i][j] = '.';
}
}
//上方(正方体正面的上面那条边为界线,下同)的+-构造
for(int i = ; i <= * b; i += ) {
for(int j = * b - i + ; j <= * b - i + + * a; j++) {
if(j & ) mp[i][j] = '+';
else mp[i][j] = '-';
}
for(int j = * b - i + + * a + ; j <= m; j++) {
if(j & ) mp[i][j] = '+';
}
}
//|/构造
for(int i = ; i <= * b; i+=) {
for(int j = * b - i + ; j <= m; j++) {
if(j % == ) mp[i][j] = '/';
}
for(int j = m; j >= m - i + ; j -= ) {
mp[i][j] = '|';
}
}
for(int i = * b + ; i <= n; i += ) {
for(int j = ; j <= m; j += ) {
mp[i][j] = '|';
}
for(int j = * a + ; j <= m; j+= ) {
mp[i][j] = '/';
}
}
//下方的+-构造
for(int i = * b + ; i <= * c + ; i += ) {
for(int j = ; j <= * a + ; j++) {
if(j & ) mp[i][j] = '+';
else mp[i][j] = '-';
}
for(int j = * a + ; j <= m; j++) {
if(j & ) mp[i][j] = '+';
}
}
for(int i = n; i > * c + ; i-=) {
for(int j = ; j <= * a + ; j++) {
if(j & ) mp[i][j] = '+';
else mp[i][j] = '-';
}
for(int j = * a + ; j <= m; j++) {
if(j & ) mp[i][j] = '+';
}
}
//我上面的处理会让下方一些应该为.的变成其他的,所以需要用.覆盖回来
int y = ;
for(int i = ; i < * b + ; i++) {
for(int j = ; j <= * b + - i; j++) {
mp[i][j] = '.';
}
}
for(int i = n; i > * c + ; i--) {
for(int j = * a + + y; j <= m; j++) {
mp[i][j] = '.';
}
y++;
}
for(int i = ; i <= n; i++) {
for(int j = ; j <= m; j++) {
printf("%c", mp[i][j]);
}
printf("\n");
}
}
return ;
}

Problem L. Visual Cube(杭电多校2018年第三场+模拟)的更多相关文章

  1. HDU6330-2018ACM暑假多校联合训练Problem L. Visual Cube

    就是画个图啦 分三个平面去画orz #include <iostream> #include <cmath> #include <cstring> #include ...

  2. (2018 Multi-University Training Contest 3)Problem L. Visual Cube

      //题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6330//题目大意:按照一定格式画出一个 a×b×c 的长方体.  #include <b ...

  3. HDU 4941 Magical Forest(map映射+二分查找)杭电多校训练赛第七场1007

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4941 解题报告:给你一个n*m的矩阵,矩阵的一些方格中有水果,每个水果有一个能量值,现在有三种操作,第 ...

  4. HDU 4902 Nice boat 2014杭电多校训练赛第四场F题(线段树区间更新)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4902 解题报告:输入一个序列,然后有q次操作,操作有两种,第一种是把区间 (l,r) 变成x,第二种是 ...

  5. HDU 多校对抗第三场 L Visual Cube

    Problem L. Visual Cube Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java ...

  6. HDU 6330.Problem L. Visual Cube-模拟到上天-输出立方体 (2018 Multi-University Training Contest 3 1012)

    6330.Problem L. Visual Cube 这个题就是输出立方体.当时写完怎么都不过,后来输出b<c的情况,发现这里写挫了,判断失误.加了点东西就过了,mdzz... 代码: //1 ...

  7. [HDU6304][数学] Chiaki Sequence Revisited-杭电多校2018第一场G

    [HDU6304][数学] Chiaki Sequence Revisited -杭电多校2018第一场G 题目描述 现在抛给你一个数列\(A\) \[ a_n=\begin{cases}1 & ...

  8. 可持久化线段树的学习(区间第k大和查询历史版本的数据)(杭电多校赛第二场1011)

    以前我们学习了线段树可以知道,线段树的每一个节点都储存的是一段区间,所以线段树可以做简单的区间查询,更改等简单的操作. 而后面再做有些题目,就可能会碰到一种回退的操作.这里的回退是指回到未做各种操作之 ...

  9. 牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献)

    牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献) 链接:https://ac.nowcoder.com/acm/contest/141/H来源:牛客网 Eddy ha ...

随机推荐

  1. 【Redis】- 延时任务

    引言 在开发中,往往会遇到一些关于延时任务的需求.例如 生成订单30分钟未支付,则自动取消 生成订单60秒后,给用户发短信 对上述的任务,我们给一个专业的名字来形容,那就是延时任务.那么这里就会产生一 ...

  2. 第24天:js-函数变量声明提升

    一.函数声明1.自定义函数function fun1(){ alert("我是自定义函数");}fun2();//函数不调用,自己不执行2.直接量声明var fun2=functi ...

  3. [JSOI2007]重要的城市 floyd:最短路计数

    ---题面--- 题解: 其实感觉还是比较妙的,第一眼看题想到floyd统计最短路条数, 注意到对于任意两点x,y而言,floyd将会枚举其最短路所可能经过的所有中转点, 因此我们可以直接分别统计对于 ...

  4. 【BZOJ1941】Hide and Seek(KD-Tree)

    [BZOJ1941]Hide and Seek(KD-Tree) 题面 BZOJ 洛谷 题解 \(KD-Tree\)对于每个点搜一下最近点和最远点就好了 #include<iostream> ...

  5. C++中typedef和#define简介

    本文基于<C++ Primer(第5版)>和网上博客,整理而成. 一.类型别名 类型别名是一个名字,它是某种类型的同义词,有两种方法可用于定义类型别名:typedef.using. 1.关 ...

  6. [Leetcode] gas station 气站

    There are N gas stations along a circular route, where the amount of gas at station i isgas[i]. You ...

  7. Java实验报告(实验四)

    北京电子科技学院(BESTI) 实     验    报     告 课程:Java    班级:1352班      姓名:王国伊    学号:20135207 成绩:             指导 ...

  8. 实验三 Java敏捷开发与XP实践

    北京电子科技学院(BESTI) 实     验    报     告 课程:Java程序设计                         班级:1353            姓名:陈巧然     ...

  9. HDU.2640 Queuing (矩阵快速幂)

    HDU.2640 Queuing (矩阵快速幂) 题意分析 不妨令f为1,m为0,那么题目的意思为,求长度为n的01序列,求其中不含111或者101这样串的个数对M取模的值. 用F(n)表示串长为n的 ...

  10. UVA.10305 Ordering Tasks (拓扑排序)

    UVA.10305 Ordering Tasks 题意分析 详解请移步 算法学习 拓扑排序(TopSort) 拓扑排序的裸题 基本方法是,indegree表示入度表,vector存后继节点.在tops ...