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 ...
随机推荐
- Python3.6 import源文件与编译文件的关系
小结: 在Python3.6中 源文件存在时,import会比较源文件与__pycache__里相应文件的时间戳,来决定是否重新生成缓存编译文件 源文件不存在时,import会导入相应的.pyc文件 ...
- C - Elephant(贪心)
Problem description An elephant decided to visit his friend. It turned out that the elephant's house ...
- Solr.NET快速入门(二)
字典映射和动态字段 Solr dynamicFields可以根据用例不同地映射. 它们可以被"静态地"映射,例如,给定: <dynamicField name="p ...
- Sql中Convert日期格式
CONVERT(data_type,expression[,style]) convert(varchar(10),字段名,转换格式) 说明:此样式一般在时间类型(datetime,smalldate ...
- ABP框架应用汇总
相信很多人可能听过或没听过ABP这个框架,在我接触此框架时也是在现在所在的公司开始接触的,我们用此开源框架作为我们项目的架构,我们正好做的是Saas云服务多租户管理系统开发,并且经过了一年多高 ...
- Super超级ERP系统---(3)基础信息管理--商品管理
商品管理主要包括商品的添加,修改,维护商品所在分类,单位,供应商,品牌,名称,价格,尺寸,规格等属性的维护. 1.商品添加 2.商品列表展示 商品列表界面左侧商品分类,右侧是商品信息
- Kettle 版本及使用问题
kettle 简介 Kettle也叫PDI (Pentaho Data Intergration) Kettle 版本及下载 7.1及更早版本: https://sourceforge.net/pro ...
- 『转』The Beginning of your Design Career
想想,如果明天我开始学日语,坚持到毕业,其实也可以日语入门了.所以机会都是抓住,当初,也就是去年的时候,我那个时候就开始坚持日语入门,想想现在应该可以开始N2了吧-所以...过去不去理会,现在开始继续 ...
- Angular ocLazyLoad 与ui-router的配合使用
1.resolve state(配置路由时)的resolve参数: resolve:object,将会被注入controller去执行的函数,<string,function>形式. 基于 ...
- 11.05 选择前n个记录
select ename,salfrom(select (select count(distinct b.sal)from emp bwhere a.sal<=b.sal) as rnk,a.s ...