zoukankan      html  css  js  c++  java
  • NBUT 2013

    • here are a LCD (Liquid Crystal Display) on Ezreal's arm. The LCD is composed of liquid crystal, and the LCD is 16 lines and 48 rows. How did it work?

       

      The CPU will send a series of bytes to the LCD. A byte means to eight bits.When the LCD received the byte, it will show a page vertically. And each byte will display from bottom to top.

       

      For example, 0x01 0x9C 0xED will be shown as below:

       

      *.*
      ...
      .**
      .**
      .*.
      ..*
      ..*
      .**

      Now give you 64 bytes, you should print it to the LCD from left to right and top to bottom. 32 columns in aBig Row (containing 8 rows).

    • 输入
    • First line contains an integer T (T < 100), means the test case.
      For each case, there are 2 lines which contain 64 hexadecimal numbers, and it is less than 0xff.
    • 输出
    • For each test case, print the LCD's status.
    • 样例输入
    • 1
      01 9C ED DD 1A 2B CF CD C3 00 19 D0 5A 9F 56 13 E5 40 E5 46 E3 BD 4F A4 39 AF D8 2D 6F D4 54 36
      1C B5 3C 24 9F 85 01 75 10 4B A0 00 77 44 77 7D 3B 82 57 47 DD DA DA 61 E5 FD F7 B7 1D E5 D3 A7
      
    • 样例输出
    • *.**.****.*..*.**.*.***.**.**...
      ....***.*...****...**.*..*..*..*
      .***..**.....**.*.**.***.*.*****
      .*******..*.**.......**.*****...
      .*.**.....******.....*..*.*..***
      ..*..*..........*.*.**.***.**..*
      ..**..***..**.*.*****.*...*.***.
      .***..***..*.*..*.*.**.*.**..*..
      .*..****.*..*.***.***..*********
      ....*....*..*.*.****.**...**..**
      ******.*....****..***...******.*
      *.*.*....*.....**...***..*..*...
      ***.*..**...*.***.*.***..****.*.
      .***...*..*.*.***......*****.*.*
      .......*.*..****..*********..**.
      .*..**....*......*..***.****.***

    #include<stdio.h>
    main()
    {char x[40][40];
    char y[40][40];
    int a,b,n,i,j,m;
    scanf("%d",&n);
    for(m=0;m<n;m++)
    {
    for(i=1;i<=32;i++)
    {scanf("%x",&a);
    for(j=0;j<=7;j++)
    {if(a&(1<<j))x[j][i]='*';
    else x[j][i]='.';
    }}
    for(i=1;i<=32;i++){
    scanf("%x",&a);
    for(j=8;j<=15;j++)
    {
    if(a&(1<<(j-8)))
    x[j][i]='*';
    else x[j][i]='.';
    }
    }for(j=0;j<=7;j++)
    {
    for(i=1;i<=32;i++)
    {
    printf("%c",x[j][i]);
    }printf(" ");}
    for(j=8;j<=15;j++){
    for(i=1;i<=32;i++)
    {
    printf("%c",x[j][i]);
    }printf(" ");}
    }
    }

    注意程序的输入技巧。

    还有16进制%x输入    C

    或者cin>>hex>>n   C++

    他们保存的都是按2进制保存的

    还有1《《1就是左移一位

    0&0=0 0&1=0  1&0=0  1&1=1

  • 相关阅读:
    数组的一些经典案例(循环)(max=score[0])(冒泡)(flag标志)(杨辉三角)
    冒泡排序
    C语言之数组
    循环结构的一些案例:倒等腰三角形、菱形、暴力破解
    break和contine关键字
    循环嵌套(打印*** ***)
    循环的经典案例(李白买酒)
    C语言循环结构-while/do...while/for--逢3过,阶乘,九九乘法表
    WordPress部署踩坑记
    Symbol
  • 原文地址:https://www.cnblogs.com/alexanderone/p/3927595.html
Copyright © 2011-2022 走看看