hdu6330(模拟)

Problem L. Visual Cube

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

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(1≤T≤50), denoting the number of test cases.
In each test case, there are 3 integers a,b,c(1≤a,b,c≤20), 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

..+-+

././|

+-+.+

|.|/.

+-+

.. ....+-+-+-+-+-+-+

.../././././././|

..+-+-+-+-+-+-+.+

./././././././|/| +-+-+-+-+-+-+.+.+

|.|.|.|.|.|.|/|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/| +

-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/. +-+-+-+-+-+-+.+.. |.|.|.|.|.|.|/... +-+-+-+-+-+-+....

Source

2018 Multi-University Training Contest 3

Recommend

chendu   |   We have carefully selected several similar problems for you:  6331 6330 6329 6328 6327 

Statistic | Submit | Discuss | Note

Home | Top Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2018 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 6, Server time : 2018-07-30 19:32:08, Gzip enabled
Administration

解析:模拟,分面来输出。上定面,正面,右边的面。

#include
using namespace std;
 
#define e exp(1)
#define pi acos(-1)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define ll long long
#define ull unsigned long long
#define mem(a,b) memset(a,b,sizeof(a))
int gcd(int a,int b){return b?gcd(b,a%b):a;}

char print[200][200];
void pr(int x,int y)
{
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=y;j++)
        {
            printf("%c",print[i][j]);
        }
        printf("\n");
    }
    return ;
}
int main()
{
    int t,a,b,c;
    cin>>t;
    while(t--)
    {
        memset(print,'.',sizeof(print));
        cin>>a>>b>>c;
        int ct=2;
        //上顶面 
        for(int i=2*b;i>=1;i--)
        {
            if(i%2==0)
            {
                for(int j=0;j=2*a+1;i--)
        {
            if(i%2==0)
            {
                for(int j=ct;j<=2*c+ct;j++) print[j][i]=(j%2==0?'/':'.');
            }
            else
            {
                for(int j=ct;j<=2*c+ct;j++) print[j][i]=(j%2==0?'|':'+');
            }
            ct++;
        }
        pr(2*b+2*c+1,2*a+2*b+1);
    }
    return 0;
}

 

你可能感兴趣的:(#,hdu,oj,#,模拟)