Problem L. Visual Cube(杭电多校2018年第三场+模拟)
题目链接: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年第三场+模拟)的更多相关文章
- HDU6330-2018ACM暑假多校联合训练Problem L. Visual Cube
就是画个图啦 分三个平面去画orz #include <iostream> #include <cmath> #include <cstring> #include ...
- (2018 Multi-University Training Contest 3)Problem L. Visual Cube
//题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6330//题目大意:按照一定格式画出一个 a×b×c 的长方体. #include <b ...
- HDU 4941 Magical Forest(map映射+二分查找)杭电多校训练赛第七场1007
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4941 解题报告:给你一个n*m的矩阵,矩阵的一些方格中有水果,每个水果有一个能量值,现在有三种操作,第 ...
- HDU 4902 Nice boat 2014杭电多校训练赛第四场F题(线段树区间更新)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4902 解题报告:输入一个序列,然后有q次操作,操作有两种,第一种是把区间 (l,r) 变成x,第二种是 ...
- HDU 多校对抗第三场 L Visual Cube
Problem L. Visual Cube Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java ...
- HDU 6330.Problem L. Visual Cube-模拟到上天-输出立方体 (2018 Multi-University Training Contest 3 1012)
6330.Problem L. Visual Cube 这个题就是输出立方体.当时写完怎么都不过,后来输出b<c的情况,发现这里写挫了,判断失误.加了点东西就过了,mdzz... 代码: //1 ...
- [HDU6304][数学] Chiaki Sequence Revisited-杭电多校2018第一场G
[HDU6304][数学] Chiaki Sequence Revisited -杭电多校2018第一场G 题目描述 现在抛给你一个数列\(A\) \[ a_n=\begin{cases}1 & ...
- 可持久化线段树的学习(区间第k大和查询历史版本的数据)(杭电多校赛第二场1011)
以前我们学习了线段树可以知道,线段树的每一个节点都储存的是一段区间,所以线段树可以做简单的区间查询,更改等简单的操作. 而后面再做有些题目,就可能会碰到一种回退的操作.这里的回退是指回到未做各种操作之 ...
- 牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献)
牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献) 链接:https://ac.nowcoder.com/acm/contest/141/H来源:牛客网 Eddy ha ...
随机推荐
- 关于PHP使用GD库生成的验证码无法在别处显示
https://segmentfault.com/q/1010000002522270
- iOS开发CAAnimation类动画, CATransition动画
#pragma mark - CAAnimation类.实现动画 #pragma mark ** CABasicAnimation 动画 - (IBAction)handleCABasicAnimat ...
- 《C陷阱与缺陷》之1词法"陷阱"
编译器中负责将程序分解为一个一个符号的部分,一般称为"词法分析器".在C语言中,符号之间的空白(包括空格符.制表符或换行符)将被忽略. 1.=不同于== C语言使用符号" ...
- win10 64位系统中安装多个jdk版本的切换问题
前言: 近期要更换oracle jdk到zulu jdk,因此在本地先安装一版zulu的来进行代码的编译和比较. 注释: 本地电脑之前是oracle jdk 1.8,要更换为zulu jdk 1.8. ...
- vue中使用monaco-editor打包文件混乱的问题
之前讲述了怎么在vue项目中使用monaco-editor (https://www.cnblogs.com/XHappyness/p/9414177.html),使用是正常的,虽然 npm run ...
- C#Color颜色表
Color.AliceBlue 240,248,255 Color.LightSalmon 255,160,122 Color.AntiqueWhite 250,235,215 Color.Light ...
- Java多线程同步机制之同步块(方法)——synchronized
在多线程访问的时候,同一时刻只能有一个线程能够用 synchronized 修饰的方法或者代码块,解决了资源共享.下面代码示意三个窗口购5张火车票: package com.jikexueyuan.t ...
- java-实用的sql语句
一.在数据库创建表格的SQL语句 1,创建一个link表格,包含属性:lid 主键,title 标题, imgpath 图片地址 , url 网址 , info 说明, isshow 显示1 ...
- E2202 Required package 'rtl' not found"
最近重新下载了一个delphi Berlin 10.1.2绿色版本,解压后剪切到别的盘上了,一些需要直接编译的.dpk包,例如fastReport都不能了,都提示E2202 Required pack ...
- stm32的两种固件下载模式:JTAG和SWD
一.JTAG模式 这种模式一般有10pin的.14pin的和20pin的,尽管引脚数和引脚的排列顺序不同,但是其中有一些引脚是一样的.值得注意的是,不同的IC公司会自己定义自家产品专属的Jtag头,来 ...