L - Problem L. Visual Cube HDU - 6330(模拟)

我是斗得在这里插入图片描述

#include<bits/stdc++.h> 
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b,c;
        cin>>a>>b>>c;
        int f=0;
        int ia=a,ib=b,ic=c;  //拷贝一份,a,b,c
        char s;
        for(int i=1;i<=c*2+1+b*2;i++){
            int ans=2*a+1;  //ans表示当前已经输出了多少字符了,定位固定,因为每一行前面都是那么多
            int k=max(0,2*b+1-i);
            ans+=k;
            
            //------------------------------------
            
            while(k--) cout<<'.';
            if(i<=2*b && i%2==0) s='/';
            else if(i%2==0) s='|';
            else s='+';
            for(int j=1;j<=a;j++){
                if(s=='+'){
                    cout<<s<<'-';
                }
                else{
                    cout<<s<<'.';
                }
            }
            cout<<s;

            if(i<=2*c+1){
                for(int q=0;q<2*a+1+2*b-ans;q++){
                    if(i&1){
                        if(q&1) cout<<'+';
                        else cout<<'.';
                    }
                    else if(i<=2*b){
                        if(q&1) cout<<'/';
                        else cout<<'|';
                    }
                    else {
                        if(q&1) cout<<'|';
                        else cout<<'/';
                    }
                }
            }
           if(i>2*c+1){
                for(int j=0;j<2*a+2*b+1-ans+f-1;j++){
                    if(i&1){
                        if(j&1) cout<<'+';
                        else cout<<'.';
                    }
                    else if(i<=2*b){
                        if(j&1) cout<<'/';
                        else cout<<'|';
                    }
                    else {
                        if(j&1) cout<<'|';
                        else cout<<'/';
                    }
                }
                for(int i=0;i<abs(f)+1;i++) cout<<'.';
                f--;
            }
            

            cout<<endl;
        }
    }
    return 0;
} 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值