Timus 1404. Easy to Hack! 有一个密码问题

When Vito Maretti writes an important letter he encrypts it. His method is not very reliable but it’s enough to make any detective understand nothing in that letter. Sheriff doesn’t like such state of affairs. He wants to hack the cipher of Vito Maretti and he promises to forget about all of your faults if you do that for him. Detectives will tell you what this cipher looks like. Each word is enciphered separately. Assume an example that consists only of the small Latin letters. At first step every letter is replaced with the corresponding number: a with 0, b with 1, c with 2, ..., z with 25.Then 5 is added to the first number, the first number is added to the second one, the second number ? to the third one and so on. After that if some number exceeds 25 it is replaced with the residue of division of this number by 26. And then those numbers are replaced back with the letters. Let’s encipher the word secret.

Step 0. s e c r e t Step 1. 18 4 2 17 4 19 Step 2. 23 27 29 46 50 69 Step 3. 23 1 3 20 24 17 Step 4. x b d u y r

We’ve got the word xbduyr.

Input

You are given an encrypted word of small Latin letters not longer than 100 characters.

Output

the original word.

Sample

input output

xbduyr

secret

原来简单的加密也不是什么难事。做了那么多加密题,我也可以随手写个加密器了。

本题就是一个字符串的操作, 考的是字符串和整形之间的转换操作:

本题注意:第一个字母小于f的时候,转换为整数就会小于5了。

#include #include #include #include #include using namespace std; void EasytoHack1404() { string s; cin>>s; vector tmp(s.size()); for (int i = 0; i

点击复制链接 与好友分享!回本站首页
您对本文章有什么意见或着疑问吗?请到论坛讨论您的关注和建议是我们前行的参考和动力
上一篇:G++和C++ && POJ 1113 Wall
下一篇:NYOJ 589 糖果
相关文章

杭电ACM2043密码的问题已经AC

BFS-hdu-1226-超级密码

hdu4433 locker 密码锁(枚举)

隐藏密码(字符串的同构与最小表示法)

HDU 1287 破译密码 异或运算

[hdu-2043] 密码

对SD卡的读写操作-保存用户登录密码

hdu 1226 超级密码 bfs

把数字串变成2012玛雅密码

SDUT OJ 2463 学密码学一定得学程序

图文推荐

Timus 1404. Easy to Hack! 有一个密码问题
ZOJ 3640 Help Me
Timus 1404. Easy to Hack! 有一个密码问题
CF 518C(Anya and
Timus 1404. Easy to Hack! 有一个密码问题
hdu 1016 Prime R
UVA - 11987 - A

分类:默认分类 时间:2015-03-09 人气:6
本文关键词:
分享到:

相关文章

Copyright (C) quwantang.com, All Rights Reserved.

趣玩堂 版权所有 京ICP备15002868号

processed in 0.082 (s). 10 q(s)