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 ...
随机推荐
- tomcat执行shutdown.sh进程残留的解决办法
我们执行shutdown.sh指令的时候有时会发现进程并没有被关掉而是越来越多,这种情况一般是项目造成的,具体原因未去调查.由于tomcat自己有相应的保护机制,所以我们只需要强制结束其进程即可,下面 ...
- 9.1、AutoEncoder自动编码器[转]
如果给定一个神经网络,我们假设其输出与输入是相同的,然后训练调整其参数,得到每一层中的权重.自然地,我们就得到了输入I的几种不同表示(每一层代表一种表示),这些表示就是特征.自动编码器就是一种尽可能复 ...
- BZOJ 1406 密码箱(数论)
很简洁的题目.求出x^2%n=1的所有x<=n的值. n<=2e9. 直接枚举x一定是超时的. 看看能不能化成有性质的式子. 有 (x+1)(x-1)%n==0,设n=a*b,那么一定有x ...
- P3065 [USACO12DEC]第一!First!
题目描述 Bessie has been playing with strings again. She found that by changing the order of the alphabe ...
- BZOJ2752:[HAOI2012]高速公路——题解
http://www.lydsy.com/JudgeOnline/problem.php?id=2752 https://www.luogu.org/problemnew/show/P2221#sub ...
- BZOJ2809:[Apio2012]dispatching——题解
http://www.lydsy.com/JudgeOnline/problem.php?id=2809 题面复制于:https://www.luogu.org/problemnew/show/155 ...
- 洛谷 P1291 [SHOI2002]百事世界杯之旅 解题报告
P1291 [SHOI2002]百事世界杯之旅 题目描述 "--在2002年6月之前购买的百事任何饮料的瓶盖上都会有一个百事球星的名字.只要凑齐所有百事球星的名字,就可参加百事世界杯之旅的抽 ...
- bzoj1968: [Ahoi2005]COMMON 约数研究(数论)
计算每一个数的贡献就好了..O(N) n/i只有2*sqrtn个取值于是可以优化到O(sqrtn) #include<bits/stdc++.h> #define ll long long ...
- Redis 的安装配置介绍
redis 是一个高性能的key-value数据库. redis的出现,很大程度补偿了memcached这类keyvalue存储的不足,在部 分场合可以对关系数据库起到很好的补充作用.它提供了Pyth ...
- 爬虫实例——爬取淘女郎相册(通过selenium、PhantomJS、BeautifulSoup爬取)
环境 操作系统:CentOS 6.7 32-bit Python版本:2.6.6 第三方插件 selenium PhantomJS BeautifulSoup 代码 # -*- coding: utf ...