NBUT-2013校赛·网络同步赛
来源:互联网 发布:走红网络的长板女孩 编辑:程序博客网 时间:2024/06/16 10:16
- 这道题目我一开始还看不懂题意,看了好久才看懂,应该是水平问题,其实就是将一个16进制的数转换成8位2进制,在8为2进制中,如果是1就输出*,否则就输出0!这里运用到了位与运算!代码中有注释!代码如下:#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int t,n,m,i,j;
char b[35][50];
cin>>t;
while(t--)
{
for(i=0; i<32; i++)
{
cin>>hex>>n;//c++中16进制数的输入!
for(j=0; j<8; j++)
{
if(n&(1<<j))b[j][i]='*';//n的第j位2进制数与1左移j位进行比较!根据位与运算法则!0&0=0;0&1=0;1&0=0;1&1=1;因为在计算机中当你输入一个16进制数时,计算机是以2进制数进行存储的!
else
b[j][i]='.';
}
}
for(i=0; i<32; i++)
{
cin>>hex>>m;
for(j=8; j<16; j++)
{
if(m&(1<<(j-8)))b[j][i]='*';
else
b[j][i]='.';
}
}
for(i=0; i<16; i++)
{
for(j=0; j<32; j++)
{
cout<<b[i][j];
}
cout<<endl;
}
}
return 0;
}题目如下:There 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.
- 样例输入
101 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 361C 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
- 样例输出
*.**.****.*..*.**.*.***.**.**.......***.*...****...**.*..*..*..*.***..**.....**.*.**.***.*.*****.*******..*.**.......**.*****....*.**.....******.....*..*.*..***..*..*..........*.*.**.***.**..*..**..***..**.*.*****.*...*.***..***..***..*.*..*.*.**.*.**..*...*..****.*..*.***.***..*********....*....*..*.*.****.**...**..********.*....****..***...******.**.*.*....*.....**...***..*..*...***.*..**...*.***.*.***..****.*..***...*..*.*.***......*****.*.*.......*.*..****..*********..**..*..**....*......*..***.****.***
- NBUT-2013校赛·网络同步赛
- Good Bye 2013 nbut
- NBUT
- NBUT
- NBUT
- NBUT
- NBUT
- 【NBUT
- NBUT
- NBUT
- NBUT
- NBUT
- NBUT
- 2013.7.19 2013NBUT暑期集训成果赛
- NBUT 2014 校赛 (Minecraft专场)
- 华中农大网络同步赛
- 2013NBUT暑期集训成果赛 赛后总结以及解题报告
- 网络同步
- 例题4-7
- 为android添加CAPS_LOCK按键
- 移动互联网应用技术架构简介-iOS
- pthread_join手册
- hdu 3221 Brute-force Algorithm
- NBUT-2013校赛·网络同步赛
- 捕获组合键VC编程
- SQLHelp类封装
- input file隐藏浏览
- P2P流媒体开源项目介绍
- NSString去掉换行符和空白字符
- 重构机房收费系统之文档 ---疑惑重重
- 用tar命令打包时如何排除指定文件和目录
- python_wxpython