Visual Cube

Problem L. Visual Cube

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1473    Accepted Submission(s): 694


Problem Description
Little Q likes solving math problems very much. Unluckily, however, he does not have good spatial ability. Everytime he meets a 3D geometry problem, he will struggle to draw a picture.
Now he meets a 3D geometry problem again. This time, he doesn't want to struggle any more. As a result, he turns to you for help.
Given a cube with length a, width b and height c, please write a program to display the cube.
 

 

Input
The first line of the input contains an integer T(1T50), denoting the number of test cases.
In each test case, there are 3 integers a,b,c(1a,b,c20), denoting the size of the cube.
 

 

Output
For each test case, print several lines to display the cube. See the sample output for details.
 

 

Sample Input
2 1 1 1 6 2 4
 

 

Sample Output
..+-+ ././| +-+.+ |.|/. +-+.. ....+-+-+-+-+-+-+ .../././././././| ..+-+-+-+-+-+-+.+ ./././././././|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/. +-+-+-+-+-+-+.+.. |.|.|.|.|.|.|/... +-+-+-+-+-+-+....
 
 
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        char Map[200][200];
        for(int i=0;i<2*b;i++)
        {
            for(int j=2*b-i;j>=0;j--)
            {
                Map[i][j] = '.';
            }
        }
        for(int i=0;i<2*b;i++)
        {
            int j;
            if(i%2==0)
            {
                int k;
                for(j=2*b-i,k=0;k<a;k++,j+=2)
                {
                    Map[i][j] = '+';
                    Map[i][j+1] = '-';
                }
                Map[i][j] = '+';
                j++;
                while(j<=(2*(a+b)))
                {
                    if(j%2==0)
                    {
                        Map[i][j] = '+';
                    }
                    else
                    {
                        Map[i][j] = '.';
                    }
                    j++;
                }
            }
            else
            {
                int k;
                for(j=2*b-i,k=0;k<a;k++,j+=2)
                {
                    Map[i][j] = '/';
                    Map[i][j+1] = '.';
                }
                Map[i][j] ='/';
                while(j<=(2*(a+b)))
                {
                    if(j%2==0)
                    {
                        Map[i][j] = '|';
                    }
                    else
                    {
                        Map[i][j] = '/';
                    }
                    j++;
                }
            }
        }

        for(int i=2*b;i<=2*b+2*c;i++)
        {
            if(i%2==0)
            {   int j;
                for(j=0;j<=2*a;j+=2)
                {
                    Map[i][j] = '+';
                    Map[i][j+1] = '-';
                }
                j--;
                while(j<=2*a+2*b)
                {
                    if(j%2==0)
                    {
                        Map[i][j] = '+';
                    }
                    else
                    {
                        Map[i][j] ='.';
                    }
                    j++;
                }
            }
            else
            {
              //  cout<<"*"<<endl;
                int j;
                for(j=0;j<=2*a;j+=2)
                {
                    Map[i][j] = '|';
                    Map[i][j+1] = '.';
                }
                j--;
                while(j<=2*a+2*b)
                {
                    if(j%2==0)
                    {
                        Map[i][j] = '|';
                    }
                    else
                    {
                        Map[i][j] ='/';
                    }
                    j++;
                }
            }
        }

        for(int i=2*c+1,k=0;i<=2*b+2*c;i++,k++)
        {
            int t = k;
            for(int j=2*a+2*b;t>=0;j--,t--)
            {
                Map[i][j] = '.';
            }
        }

        for(int i=0;i<=2*b+2*c;i++)
        {
            for(int j=0;j<=2*a+2*b;j++)
            {
                cout<<Map[i][j];
            }
            cout<<endl;
        }
    }
}

 

posted @ 2018-08-03 13:43  zangzang  阅读(332)  评论(0编辑  收藏  举报