ENCRYPT - SecretMessagePad
Secret Message Pad
Hearing stories from the Oracle that a programmer named Neo may possibly be "The One", Trinity risks going into the Matrix to observe Neo. While in the Matrix, her communications are intercepted and Trinity is almost caught by Agent Smith and two other agents. Safely back in the hovercraft Nebuchadnezzar,Trinity decides to add another level of encryption to her communication using a "one-time pad".
The idea is that given a sequence of numbers (a pad), any message can be proven to be securely encrypted if each character in the string is encoded by a number from the pad, if each number from the pad is only used onc. Trinity decides to use the one-time pad to encrypt the rmessages by shifting each letter in the message by k positions later in the alphabet,where k is determined by the one-time pad.
Shifts occur in alphabetical order, between the letters "a" and "z". If a letter is shifted past "z", it starts back at "a"and continues shifting.
For example,shifting each letterby k = 2, the word "car" is transformed into " ect",while the word"yaz"is shifted to "acb".
Input Format
The input will begin with the size of the one-time pad, followed by a sequence of numbers for the pad.
The remaining input consists of a series of words to be encrypted using the keyword. The input will be terminated by a line containing only 1. You may assume that the maximum size of the pad is 100numbers all numbers in the pad are between 0and25,and that all input will be lowercaseletters.
Output Format
For each word to be encrypted,output aline containing the encrypted word.
Example
Input1: 10 1 2 3 4 5 4 3 2 1 0
aaaaa zzzzz
1
Output1: bcdef
dcbaz
Input2: 40 1 5 2 21 3 8 42511 9
6 7 8 91112 3 0 11 4
14 21 9 0 1 3 12 7 2 11
5 9 20 12 1 19 4 9 8 24
humans make good batteries gnlr esrf
1
Output2:
izovqa
qzvn
mmwtpvwzb
good luck
hide comments
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-01-18 15:50:14
Please hide this problem soon, I'm 100% sure that test data is invalid! |
|
Aayush:
2013-01-16 19:22:42
To the author : The formatting in the input file is incorrect. Just like in the second test case here. You have probably given no gaps between the numbers and my program gets TLE because it keeps waiting for input. Please rectify this asap.
|
|
Pranay:
2013-01-16 13:44:38
also will the input string be all in one line ? |
|
Nnavneetsinha:
2013-01-16 11:08:42
In the Input specification it is written that the numbers are b/w 0 - 25 .but in the 2nd input there are numbers like 91112 and 42511? are they 9 11 12 and 4 25 11??
|
Added by: | Vasavi OPC Team |
Date: | 2013-01-16 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ASM32-GCC MAWK BC C-CLANG C NCSHARP CSHARP CPP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PS PROLOG PYPY PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET |
Resource: | http://www.cs.umd.edu |