ZOJ 1006 Do the Untwist 加密解密 模拟
来源:互联网 发布:smplayer linux 编辑:程序博客网 时间:2024/06/05 20:44
题意:加密、解密
题解:
#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int key;int c2i[1000];char i2c[1000];void init(){ for(int i = 'a'; i <= 'z'; i++) c2i[i] = i - 'a' + 1; c2i['_'] = 0; c2i['.'] = 27; i2c[0] = '_'; i2c[27] = '.'; for(int i = 1; i <= 26; i++) i2c[i] = 'a' + i - 1;}int main(){ init(); char ciphertext[100]; int ciphercode[100]; int plaincode[100]; char plaintext[100]; while(~scanf("%d",&key)) { if(key == 0) break; scanf("%s",ciphertext); int len = strlen(ciphertext); for(int i = 0; i < len; i++) ciphercode[i] = c2i[ciphertext[i]]; for(int i = 0; i < len; i++) plaincode[(key*i)%len] = (ciphercode[i] + i) % 28; for(int i = 0; i < len; i++) plaintext[i] = i2c[plaincode[i]]; plaintext[len] = '\0'; printf("%s\n", plaintext); }}
- ZOJ 1006 Do the Untwist 加密解密 模拟
- ZOJ-1006-Do the Untwist
- zoj 1006 Do the Untwist
- ZOJ 1006 Do the Untwist
- zoj 1006 Do the Untwist
- zoj 1006 Do the Untwist
- Zoj 1006 Do the Untwist
- zoj 1006 Do the Untwist
- ZOJ 1006 Do the Untwist
- ZOJ 1006 Do the Untwist
- ZOJ--1006:Do the Untwist
- ZOJ 1006 Do the Untwist
- ZOJ Problem Set - 1006 Do the Untwist
- ZOJ Problem Set - 1006 Do the Untwist
- ZOJ Problem Set - 1006 Do the Untwist
- ZOJ Problem Set - 1006 Do the Untwist
- ZOJ 1006 Do the untwist T^T
- Do the Untwist (1006)
- protobuf 中 examples的编译 cpp和python
- Web 开发最有用的50款 jQuery 插件集锦——《内容滑块篇》
- 纽曼平板 T9 ROOT过程
- 微信收费事件背后被广泛忽略的技术细节
- mysql数据库复习之三(备份和导入)
- ZOJ 1006 Do the Untwist 加密解密 模拟
- 将一个字符串的元音字母复制到另一个字符串并排序
- 小菜学C之递归
- jQuery 小案例图片切换
- Java中的容器
- Spring3 MVC 的介绍和使用(重排版转载收录)
- Handler使用
- java中的try中的return和finally的执行顺序问题
- C++ 利用类的静态成员特性定义全局变量来存储信息