HDU - 4054 Hexadecimal View (2011 Asia Dalian Regional Contest)
题意:按要求输出。第一列是表示第几行。每行仅仅能有16个字节的字母,第二列是16进制的ASCII码。第三列大写和小写转换
思路:纯模拟,注意字母的十六进制是2位
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 5000; char str[MAXN]; int main() {
while (cin.getline(str, 4100)) {
int len = strlen(str);
for (int t = 0; t < len ; t += 16) {
printf("%04x: ", t);
for (int i = t; i < t+16; i += 2) {
if (i < len)
printf("%02x", str[i]);
else printf(" ");
if (i+1 < len)
printf("%02x", str[i+1]);
else printf(" ");
printf(" ");
}
for (int i = t; i < len && i < t+16; i++) {
if (str[i] >= 'a' && str[i] <= 'z')
printf("%c", str[i]-'a'+'A');
else if (str[i] >= 'A' && str[i] <= 'Z')
printf("%c", str[i]-'A'+'a');
else printf("%c", str[i]);
}
printf("\n");
}
}
return 0;
}
HDU - 4054 Hexadecimal View (2011 Asia Dalian Regional Contest)的更多相关文章
- HDU 4115 Eliminate the Conflict(2-SAT)(2011 Asia ChengDu Regional Contest)
Problem Description Conflicts are everywhere in the world, from the young to the elderly, from famil ...
- HDU-4432-Sum of divisors ( 2012 Asia Tianjin Regional Contest )
Sum of divisors Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- HDU 3696 Farm Game(拓扑+DP)(2010 Asia Fuzhou Regional Contest)
Description “Farm Game” is one of the most popular games in online community. In the community each ...
- UVALive 7147 World Cup(数学+贪心)(2014 Asia Shanghai Regional Contest)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=6 ...
- ZOJ 3545 Rescue the Rabbit(AC自动机+状压DP)(The 2011 ACM-ICPC Asia Dalian Regional Contest)
Dr. X is a biologist, who likes rabbits very much and can do everything for them. 2012 is coming, an ...
- HDU 3695 / POJ 3987 Computer Virus on Planet Pandora(AC自动机)(2010 Asia Fuzhou Regional Contest)
Description Aliens on planet Pandora also write computer programs like us. Their programs only consi ...
- HDU 4436 str2int(后缀自动机)(2012 Asia Tianjin Regional Contest)
Problem Description In this problem, you are given several strings that contain only digits from '0' ...
- HDU 3685 Rotational Painting(多边形质心+凸包)(2010 Asia Hangzhou Regional Contest)
Problem Description Josh Lyman is a gifted painter. One of his great works is a glass painting. He c ...
- HDU 3686 Traffic Real Time Query System(双连通分量缩点+LCA)(2010 Asia Hangzhou Regional Contest)
Problem Description City C is really a nightmare of all drivers for its traffic jams. To solve the t ...
随机推荐
- (Go)03.go类型
1.1 变量Go 是静态类型语⾔言,不能在运⾏行期改变变量类型.使⽤用关键字 var 定义变量,⾃自动初始化为零值.如果提供初始化值,可省略变量类型,由编译器⾃自动推断. var x int var ...
- .net core发布到IIS后502.5错误
net core 在win7系统发布后,出现在502.5错误. 打开“开始”菜单,搜索“事件查看器”,然后选择“事件查看器”应用. 在“事件查看器”中,打开“Windows 日志”节点. 选择“应用程 ...
- BZOJ 3910 并查集+线段树合并
思路: 1. 并查集+线段树合并 记得f[LCA]==LCA的时候 f[LCA]=fa[LCA] 2.LCT(并不会写啊...) //By SiriusRen #include <cstdio& ...
- Css 分类 属性 选择器
Css 层叠样式表 美化页面的小工具 分类: 内联 (行内)在标签内部以属性的形式呈现,属性名style 内嵌 head标签内以标签形式呈现,标签名style 外部 head标签内 加link标签 引 ...
- 【Arduino】基于arduino的激光坦克
历经了总共40来个小时,终于将这个激光坦克做好了. 这是本人的第一件像样的arduino作品. 用arduino为主控制器,配有32路舵机驱动板(在这有些大材小用了),以及一个wr703n的路由器当做 ...
- deeplearning4j – 分布式DL开源项目
原文链接:http://www.52ml.net/16157.html Deeplearning4j is the first commercial-grade deep learning libra ...
- (转)shiro权限框架详解02-权限理论介绍
http://blog.csdn.net/facekbook/article/details/54893042 权限管理解决方案 本文主要介绍权限管理的解决方法: 粗颗粒度和细颗粒度 基于url拦截 ...
- spring4+hibernate4+struts2环境搭建
tomact配置请查看下面的文章 javaEE_maven_struts2_tomcat_first http://www.cnblogs.com/luotuoke/p/4543686.html po ...
- 'input propertychange' 当输入框文字改变时触发的事件!
$('.amount_input').bind('input propertychange', function() { console.log(2); $('.list label').remove ...
- Debian 6 , 十个串口为什么只识别到了 6个 剩下4 个被禁止了
0.946441] Serial: 8250/16550 driver, 6 ports, IRQ sharing enabled [ 0.946533] serial8250: ttyS0 a ...