wikioi1197 Vigenère密码
来源:互联网 发布:cf网络原因连接失败6 编辑:程序博客网 时间:2024/05/21 09:59
简单找规律的题,仔细研究一下图表即可。
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;int a[30][30];char ch,essay[1100];int key[110],st[1100];bool flag[1100];int lk,lst;void init(){ for(int i=1;i<=26;i++) { for(int j=1;j<=26;j++) { a[i][j]=(i+j-2)%26+1; } }}void work(int s){ int kloc=(s-1)%lk+1; for(int i=1;i<=26;i++) { if(a[key[kloc]][i]==st[s]) { if(flag[s]) { int t=i+'A'-1; printf("%c",t); } else { int t=i+'a'-1; printf("%c",t); } break; } }}int main(){ scanf("%s",essay); lk=strlen(essay); for(int i=0;i<strlen(essay);i++) { if(essay[i]>='A' && essay[i]<='Z') { key[i+1]=essay[i]-'A'+1; } else { key[i+1]=essay[i]-'a'+1; } } memset(essay,NULL,sizeof(essay)); scanf("%s",essay); lst=strlen(essay); for(int i=0;i<strlen(essay);i++) { if(essay[i]>='A' && essay[i]<='Z') { st[i+1]=essay[i]-'A'+1; flag[i+1]=true; } else { st[i+1]=essay[i]-'a'+1; } } init(); for(int i=1;i<=lst;i++) { work(i); } return 0;}
0 0
- wikioi1197 Vigenère密码
- Vigenère 密码
- NOIP2012 Vigenère密码
- 【noip2012】Vigenère密码
- Vigenère密码题解
- Vigenère密码题解
- NOIP2012 Vigenère 密码
- Vigenère 密码题解
- 【NOIP2012】 Vigenère密码
- noip2012 Vigenère密码
- [noip2012tg] Vigenère密码
- [noi2012]Vigenère 密码
- 【noip2012】Vigenère 密码
- 【模拟】[NOIP2012]Vigenère密码
- Wikioi P1197 Vigenère密码
- 08:Vigenère密码题解
- 洛谷 P1079 Vigenère 密码
- NOIP 2012 Vigenère 密码
- 初识ASP.NET---若干常见错误
- 陶哲轩:如何开始你的数学生涯I(2007-06-09 18:10:12)
- unity3d 自定义属性视图
- Linux 集群大全
- 满足的AK-47冲锋枪
- wikioi1197 Vigenère密码
- 【树状数组】 ACdream 1127 Base Station
- 【转】FragmentPagerAdapter与FragmentStatePagerAdapter
- MATLAB R2014a 中文语言界面转换为英文(添加环境变量)
- HDU 3032 Nim or not Nim?
- Spring mvc中@RequestMapping 6个基本用法小结
- wikioi1198 国王游戏
- 编码注意事项
- 海盗服装万圣节奇装异服