zoj 1006
来源:互联网 发布:babel js 编辑:程序博客网 时间:2024/04/29 19:39
给出plaintext 求 ciphertext
#include<stdio.h>#include<string.h>//这个程序,给出plaintext 求 ciphertext int main(){ int k,n,i,temp,c[75],p[75]; char ct[75],pt[75]; ct[0]='_',ct[27]='.'; for(i=1;i<=26;i++) ct[i]='a'+i-1; while(scanf("%d",&k)&&k) { scanf("%s",pt); n=strlen(pt); for(i=0;i<n;i++) { if(pt[i]=='_') p[i]=0; else if(pt[i]=='.') p[i]=27; else p[i]=pt[i]-'a'+1; } for(i=0;i<n;i++) { temp=(k*i)%n; c[i]=(p[temp]-i)%28; if(c[i]<0) c[i]+=28; printf("%c",ct[c[i]]); } printf("\n"); } return 0;}给出 ciphertext 求plaintext
#include<stdio.h>#include<string.h>//这个程序,给出 ciphertext 求plaintext int main(){ int k,n,i,temp,pos,c[75],p[75]; char ct[75],pt[75]; pt[0]='_',pt[27]='.'; for(i=1;i<=26;i++) pt[i]='a'+i-1; while(scanf("%d",&k)&&k) { scanf("%s",ct); n=strlen(ct); for(i=0;i<n;i++) { if(ct[i]=='_') c[i]=0; else if(ct[i]=='.') c[i]=27; else c[i]=ct[i]-'a'+1; } for(i=0;i<n;i++) { pos=k*i%n; p[pos]=(c[i]+i)%28; } for(i=0;i<n;i++) printf("%c",pt[p[i]]); printf("\n"); } return 0;}
- ZOJ 1006
- zoj-1006
- zoj 1006
- ZOJ-1006
- ZOJ 1006
- ZOJ 1006
- ZOJ 1006
- 1006 zoj
- zoj 1006
- ZOJ 1006
- 水水 zoj 1099 水水水zoj 1006 && zoj 1365
- zju 1006 zoj 1006
- 题目1006:ZOJ问题
- 题目1006:ZOJ问题
- 题目1006:ZOJ问题
- zoj 1006 Java
- 题目1006:ZOJ问题
- ZOJ 1006 的代码
- Howto: Ubuntu下的AMSS编译环境配置
- OpenStack常用命令小结
- AMSS编译环境搭建
- 让Mac OS X的终端多姿多彩
- 数据结构之 折半插入排序
- zoj 1006
- Go基础学习-goroutine
- Java模拟web服务器
- 想成为嵌入式程序员应知道的0×10个基本问题
- 给myeclipse中xml添加代码提示和关联源码不再见source not found
- 值类型不是值类型(ValueType is NOT a Value Type):闲谈.Net类型
- 平行实景游戏——生活就是游戏
- K-均值聚类分析
- HOWTO: Be more productive