HDU 1591 Encoded Love-letter(简单字符串)
Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1780    Accepted Submission(s): 635
Each charactor are changed to a corresponding charactor. If the keyword is "Angel", the rule will be:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ANGELZYXWVUTSRQPOMKJIHFDCB
You may find that in the bottom line, charactors of the keyword come first. All other charactors will come in a reversed order.
Now given another keyword, work the letter out!
Can you write a program to translate the letter?
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char sh[],s[];
char c;
int i,j,k,l,m,n;
void ac(char sh[])
{
l=strlen(sh);
for(i=;i<l;i++)
if(sh[i]>='a'&&sh[i]<='z')
sh[i]-=;//先变成大写
for(i=;i<l;i++)
s[i]=sh[i];
int flag=;
for(i=;i>=;i--)//得到密码字符串
{
for(j=;j<l;j++)
if('Z'-i==sh[j])
break;
if(j==l)
s[flag--]='Z'-i;
}
}
int main()
{
scanf("%s",sh);
getchar();
ac(sh);
while(scanf("%c",&c)!=EOF)//逐个字母输入
{
for(i=;i<;i++)
{
if(c==s[i])
{
printf("%c",'A'+i);
break;
} if(c==s[i]+)
{
printf("%c",'a'+i);
break;
}
}
if(i==)
printf("%c",c);
}
}
HDU 1591 Encoded Love-letter(简单字符串)的更多相关文章
- HDU 5907 Find Q(简单字符串)
		传送门 Description Byteasar is addicted to the English letter 'q'. Now he comes across a string S consi ... 
- hdu 5059 简单字符串处理
		http://acm.hdu.edu.cn/showproblem.php?pid=5059 确定输入的数是否在(a,b)内 简单字符串处理 #include <cstdio> #incl ... 
- CF 208A  Dubstep(简单字符串处理)
		题目链接: 传送门 Dubstep Time Limit: 1000MS Memory Limit: 32768 KB Description Vasya works as a DJ in t ... 
- 第一部分之简单字符串SDS(第二章)
		一,什么是SDS? 1.引出SDSC字符串:c语言中,用空字符结尾的字符数组表示字符串简单动态字符串(SDS):Redis中,用SDS来表示字符串.在Redis中,包含字符串值的键值对在底层都是由SD ... 
- C 封装一个通用链表 和 一个简单字符串开发库
		引言 这里需要分享的是一个 简单字符串库和 链表的基库,代码也许用到特定技巧.有时候回想一下, 如果我读书的时候有人告诉我这些关于C开发的积淀, 那么会走的多直啊.刚参加工作的时候做桌面开发, 服务是 ... 
- 1442: Neo 的简单字符串(字符串)
		1442: Neo 的简单字符串 时间限制: 10 Sec 内存限制: 128 MB 提交: 9 解决: 3 统计 题目描述 Neo 给你一系列字符串,请你输出字符串中的不同单词个数以及总单词个数. ... 
- HDU 1753 大明A+B(字符串模拟,简单题)
		简单题,但要考虑一些细节: 前导0不要,后导0不要,小数长度不一样时,有进位时,逆置处理输出 然后处理起来就比较麻烦了. 题目链接 我的代码纯模拟,把小数点前后分开来处理,写的很繁杂,纯当纪念——可怜 ... 
- HDU 2672 god is a girl (字符串处理,找规律,简单)
		题目 //1,1,2,3,5,8,13,21,34,55…… //斐波纳契数列 #include<math.h> #include<stdio.h> #include<s ... 
- HDU——2112HDU Today(SPFA+简单Hash或map+前向星)
		HDU Today Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ... 
随机推荐
- zeptojs库解读2之事件模块
			第一,通过obj.addEventListener("click",fn)绑定的事件,你不能通过obj.onclick = null;来移除绑定点击事件的所有回调函数. 所以引入第 ... 
- shell 关系运算符
			关系运算符 关系运算符只支持数字,不支持字符串,除非字符串的值是数字. 下表列出了常用的关系运算符,假定变量 a 为 10,变量 b 为 20: 运算符 说明 举例 -eq 检测两个数是否相等,相等返 ... 
- Qt_QString::split测试
			1. #define GID_PREFIX "dr_" QString str = "dr__awedr4"; QString str1; QStringLis ... 
- VC_可再发行组件包
			1. 中文 : 可再发行组件包 英文 : Redistributable Package 例子 : Download Microsoft Visual C++ 2010 Redistributable ... 
- [ios][swift]文本框UITextField用法
			参考:http://www.hangge.com/blog/cache/detail_530.html 
- Fast R-CNN论文理解
			论文地址:https://arxiv.org/pdf/1504.08083.pdf 翻译请移步:https://blog.csdn.net/ghw15221836342/article/details ... 
- php 8小时时间差的解决方法小结
			原来从php5.1.0开始,php.ini里加入了date.timezone这个选项,默认情况下是关闭的 也就是显示的时间(无论用什么php命令)都是格林威治标准时间 和我们的时间(北京时间)差了正好 ... 
- 【异常】redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'PSETEX'
			在spring中 针对 RedisTemplate类: private RedisTemplate<String, String> template; 当调用下面方法 template.o ... 
- Confluence 6 LDAP 连接池配置参数
			初始连接池大小(Initial Pool Size) 当初始化 LDAP 连接池的时候初始化创建的 LDAP 连接数量. 1 期望的连接池大小(Preferred Pool Size) 优化连接池的大 ... 
- struts2整合axis2后,访问不到wsdl,被struts2拦截的解决办法
			在struts2中整合axis2后,访问wsdl的时候显示404 not found There is no Action mapped for action name xxxxxxxx. 解决办法 ... 
