【瞎搞】HDU 3257 Hello World!

题目只说了输入16进制的数 和输出6×n-1个行

则知一个字母由5竖 7个带#号或者空格组成

发现输入的十六进制数转化为二进制 倒过来正好对应一个字母的一竖 0对应着空格 1对应着# 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <math.h>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <set>
#include <map>
//#define LOCAL_TEST
typedef long long LL;
typedef pair<int, int> pi;
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define N 120000

int ans[85][8][8];
int main()
{
#ifdef LOCAL_TEST
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int t, ca=1;
    scanf("%d", &t);
    while(t--)
    {
        int n, a;
        scanf("%d", &n);
        memset(ans, 0, sizeof(ans));
        for(int i=0;i<n;i++)
            for(int j=0;j<5;j++)
            {
                scanf("%x", &a);//输入十六进制
                int d=0;
                while(a)//转化为二进制
                {
                    ans[i][j][d++]=a%2;
                    a/=2;
                }
            }
        printf("Case %d:\n\n", ca++);//中间要空一行
        for(int i=0;i<7;i++)
        {
           for(int j=0;j<5*n;j++)
           {
                if(j!=0 && j%5==0)
                    printf(" ");
                if(ans[j/5][j%5][i]==0)
                    printf(" ");
                else
                    printf("#");

            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


转载于:https://www.cnblogs.com/kewowlo/p/4002561.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值