题目链接: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. headers的描述

    Cache-Control 作用: 这个是非常重要的规则. 这个用来指定Response-Request遵循的缓存机制.各个指令含义如下 Cache-Control:Public   可以被任何缓存所 ...

  2. PAT L1-048 矩阵A乘以B

    https://pintia.cn/problem-sets/994805046380707840/problems/994805082313310208 给定两个矩阵A和B,要求你计算它们的乘积矩阵 ...

  3. cURL和file_get_contents实现模拟post请求

    以前面试时候,面试官问过我后端有没有跨域问题,但是不敢肯定,现在可以肯定的说没有. 不文用php的cURL和file_get_contents方法分别实现后端跨域.本文场景也是在tp5下实现的. 一, ...

  4. nginx 设置默认虚拟 host

    nginx 设置默认虚拟 host listren 80 default_server

  5. Spring Bean注册和加载

    Spring解密 - XML解析 与 Bean注册 Spring解密 - 默认标签的解析 Spring解密 - 自定义标签与解析 Spring解密 - Bean的加载流程

  6. linux 装redmine

    看第一篇 https://www.cnblogs.com/iluzhiyong/p/redmine.html 看第二篇 http://blog.51yip.com/cloud/1874.html 基本 ...

  7. WPF比较两个随机数大小写,利用MVVM思想实现

    MVVM模式是把表现层和业务层完全分离,所以这里就使用MVVM制作一个极其简单的WPF的例子: 先看看最终图:

  8. 【】Python】异常处理try...except、raise

    一.try...except 有时候我们写程序的时候,会出现一些错误或异常,导致程序终止.例如,做除法时,除数为0,会引起一个ZeroDivisionError 例子: 1 2 3 4 a=10 b= ...

  9. 【bzoj4491】我也不知道题目名字是什么 离线扫描线+线段树

    题目描述 给定一个序列A[i],每次询问l,r,求[l,r]内最长子串,使得该子串为不上升子串或不下降子串 输入 第一行n,表示A数组有多少元素接下来一行为n个整数A[i]接下来一个整数Q,表示询问数 ...

  10. 转:浅谈Spectral Clustering 谱聚类

    浅谈Spectral Clustering Spectral Clustering,中文通常称为“谱聚类”.由于使用的矩阵的细微差别,谱聚类实际上可以说是一“类”算法. Spectral Cluste ...