TOJ 3070. Encryption
来源:互联网 发布:手机变平板软件 编辑:程序博客网 时间:2024/05/17 08:21
数字转ACS||码的方法为+'0';
You must have heard of an ancient encryption called Caesar cipher or 'shift cipher'. That is, given the plaintext and a numberD, you should replace every character c in the plaintext with another character which isD places after c in the alphabet. For example, if D = 2, you should replace 'a' with 'c', replace 'b' with 'd', ... replace 'y' with 'a', and replace 'z' with 'b'.
Given the plaintext and D, you should output the cipher text.
Input
The first line is an integer T, the number of test cases. Then T cases follows.Each case contains only one line, consists of the plaintext and the number D, separated by a space. You can assume there are only lower case letters in the plaintext, and the length is no more than 100. 0 ≤D < 26.
Output
Output one line for each test case, indicating the cipher text.Sample Input
2tjucs 1abcd 0
Sample Output
ukvdtabcd
#include<iostream>#include<string>using namespace std;int main(){string s="abcdefghijklmnopqrstuvwxyz";string c;char b;int n,d,l,j;cin>>n;while(n--){cin>>c>>d;//cout<<c<<endl;//cout<<d<<endl;l=c.length();j=0;for(int i=0;i<l;i++){int k=c[i]-'0'+d;//cout<<k<<" ";if(k>74)k=k-74+48;b=k+'0';cout<<b;}cout<<endl;}return 0;}
0 0
- TOJ 3070. Encryption
- TOj 3070. Encryption【水题】
- Encryption
- XML Encryption
- encryption:gpg
- Encryption Technology
- DATA ENCRYPTION
- AES encryption
- toj3070 Encryption
- Text Encryption
- Encryption && Decryption
- With Encryption
- TOJ 2976
- toj 3140
- toj 1153
- TOJ 1772
- TOJ 3250
- TOJ 3051
- android 网络判断
- leetCode->Climbing Stairs
- .NET技术+25台服务器怎样支撑世界第54大网站
- 简单实现运算符重载
- #第五日 笔记 7/25
- TOJ 3070. Encryption
- 时钟
- 【数据结构和算法分析】双链表的增,删操作
- MySQL高可用之——keepalived+互为主从
- struts2获取response
- Lotus中关于字符串处理的函数汇总
- 归并排序--详解
- POJ 1011 Sticks
- android在代码里直接画出环形统计图