Problem L. Visual Cube(杭电多校2018年第三场+模拟)

时间:2023-03-09 19:34:56
Problem L. Visual Cube(杭电多校2018年第三场+模拟)

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

题目:

Problem L. Visual Cube(杭电多校2018年第三场+模拟)

Problem L. Visual Cube(杭电多校2018年第三场+模拟)

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

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

代码实现如下:

 #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 ;
}