Day 3 L - Visual Cube HDU 6330 | 模拟

最开始写的时候很乱,想了大概就动手写了,到后来一直WA(要多测几组自己的样例)心态崩了,改循环的时候就一次次凭感觉改输出看效果,感觉冷静不下来去想了。出去上个厕所冷静一下之后回来重新先梳理一遍,又新开了个工程开始写orz 就,不是特别难的模拟,也没卡时间啥的,但是要耐心耐心耐心,而且要细心!这题写了三个多小时……唉

#include <bits/stdc++.h>

using namespace std;

#define totalh 2*z+2*y+1
#define totall 2*x+2*z+1
int T, x, y, z;
int main()
{
    scanf("%d", &T);
    while(T)
    {
        scanf("%d%d%d", &x, &z, &y);

        int dotcnt = 0;
        for(int h = 1;h <= totalh;h++)
        {
            if(totalh - h < 2*z)
                dotcnt++;

            int hangcnt = 0;
            for(int l = 1;l <= totall;l++)
            {
                if(h <= 2*z && l <= 2*z-h+1)
                {
                    printf(".");
                    continue;
                }

                if(hangcnt < 2*x+1 && h <= 2*z)
                {
                    if(h%2 == 1)
                    {
                        if(l%2 != 0)
                            printf("+");
                        else
                            printf("-");
                    }
                    else
                    {
                        if(l%2 != 0)
                            printf(".");
                        else
                            printf("/");
                    }
                    hangcnt++;
                    continue;
                }

                if(hangcnt < 2*x+1 && h > 2*z)
                {
                    if(h%2 == 1)
                    {
                        if(l%2 != 0)
                            printf("+");
                        else
                            printf("-");
                    }
                    else
                    {
                        if(l%2 != 0)
                            printf("|");
                        else
                            printf(".");
                    }
                    hangcnt++;
                    continue;
                }


                //if(totalh - h >= 2*z)
                //{
                    if(totall - l - dotcnt >= 0)
                    {
                        //cout << totall - l << "- " << dotcnt;
                        if(h % 2==0)
                        {
                            if(l%2==0)
                                printf("/");
                            else
                                printf("|");
                        }
                        else
                        {
                            if(l%2==0)
                                printf(".");
                            else
                                printf("+");
                        }
                        continue;
                    }
                    else
                        printf(".");
                //}
            }
            printf("\n");
        }
        //printf("\n");
        T--;
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值