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 | TopHangzhou 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<bits/stdc++.h>
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<a;j++)   print[i][ct+2*j]='/';
            }
            else
            {
                 for(int j=0;j<2*a;j++)   print[i][ct+j]=(j%2==0?'+':'-');
            }
            ct++;
        }
        //正面 
        for(int i=2*b+1;i<=2*b+2*c+1;i++)
        {
            if(i%2==1)
            {
                for(int j=1;j<=2*a;j++)   print[i][j]=(j%2==0?'-':'+');
            }
            else
            {
                for(int j=0;j<a;j++)   print[i][1+2*j]='|';
            }
        }

        ct=1;
        //右边的面 
        for(int i=2*a+2*b+1;i>=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;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值