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 ...
随机推荐
- thinkphp 内存查询表 防止多次查库
//从内存查询 表 以防止多次查库 private static function selectTable($tableName,array $where,$getFirst=false){ $res ...
- subprocess学习
转自http://blog.csdn.net/imzoer/article/details/8678029 subprocess的目的就是启动一个新的进程并且与之通信. subprocess模块中只定 ...
- java+appium+安卓模拟器实现app自动化Demo
网上有比较多相关教程,自己写一遍,加深下印象. 环境搭建 据说,很多人都被繁琐的环境搭建给吓到了. 是的,确实,繁琐. node.js 网址 cmd输入node -v,出现下图说明成功. JDK 网址 ...
- js编写时间选择框
效果图: 代码: 新建js:WdatePicker.js /* * My97 DatePicker 4.72 Release * License: http://www.my97.net/dp/lic ...
- RocketMQ之基本信息
1.Producer 即消息生产者,负责产生消息,一般由业务系统负责产生消息. 2.Consumer 即消息消费者,负责消费消息,一般是后台系统负责异步消费. 3.Push Consumer Cons ...
- Redux入门
Redux入门 本文转载自:众成翻译 译者:miaoYu 链接:http://www.zcfy.cc/article/4728 原文:https://bumbu.github.io/simple-re ...
- 3D旋转立方体案例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Android RecyclerView、ListView实现单选列表的优雅之路.
一 概述: 这篇文章需求来源还是比较简单的,但做的优雅仍有值得挖掘的地方. 需求来源:一个类似饿了么这种电商优惠券的选择界面: 其实就是 一个普通的列表,实现了单选功能, 效果如图: (不要怪图渣了 ...
- 上传图片到PHP服务器
test_picture = function() { api.getPicture({ sourceType: 'library', encodingType: 'png', mediaValue: ...
- Fiddler4抓包工具使用教程
本文参考自http://blog.csdn.net/ohmygirl/article/details/17846199,纯属读书笔记,加深记忆 1.抓包工具有很多,为什么要使用Fiddler呢?原因如 ...