HDU -6330 - Problem L. Visual Cube
题意:
给一个长方体的长宽高,按照样例画出这一个长方体
/* 将其分为了如下两个部分来分别画出
....+-+-+-+-+-+-+
.../././././././|
..+-+-+-+-+-+-+.+
./././././././|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/.
+-+-+-+-+-+-+.+..
|.|.|.|.|.|.|/...
+-+-+-+-+-+-+....
*/
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
typedef long long int LL;
int T, x, y, z;
int main()
{
scanf("%d",&T);
while(T--){
scanf("%d%d%d",&x,&y,&z);
int h = y*2+z*2+1;
int w = x*2+y*2+1;
for(int i=1;i<=y*2;i++){
for(int j=1;j<=w;j++){
if(j <= y*2-i+1 || j >= 2*x+2+h-i) printf(".");
else {
if(i & 1) {
if(j & 1) printf("+");
else {
if(j <= y*2-i+1+x*2+1) printf("-");
else printf(".");
}
}else {
if(j % 2 == 0) printf("/");
else {
if(j <= y*2-i+1+x*2+1) printf(".");
else printf("|");
}
}
}
}
printf("\n");
}
for(int i=1+2*y;i<=h;i++){
for(int j=1;j<=w;j++){
if(j >= 2*x+2+h-i) printf(".");
else {
if(i & 1) {
if(j & 1) printf("+");
else {
if(j<=x*2+1) printf("-");
else printf(".");
}
} else {
if(j & 1) printf("|");
else {
if(j<=x*2+1) printf(".");
else printf("/");
}
}
}
}
printf("\n");
}
}
return 0;
}