decipher the code .
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 3249 Accepted Submission (s): 1466
Problem Description has a country called "the Pig", using a simple grammar encryption, the language in which they use only uppercase letters, no other characters; now also know that they are encrypted by using only one uppercase letter and the original text to generate ciphertext. Please help untie it.
Input has several groups, each set of input has 2 rows, the first row of integer n indicates that there are n ciphertext, followed by a row of n integers representing n cipher text.
Output outputs only the original text that consists of uppercase letters.
Sample Input
30 17 6 9 8 3 0 1 6 7 4 5 10 11 8 9 14 15 12 13 18 19 16 17 22 23 20 21 26 27 24
Sample Output
sdkjabcdefghijklmnopqrstuvwxyz a ^ b = c a ^ c = b b ^ c = a
#include <iostream>//bit arithmetic
#include <cstdio>
#include <cstring>
using namespace std;
Char dic[27]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
int arr[1000000];
int main ()
{
int t;
while (scanf ("%d", &t)! = EOF)
{
for (int i = 0; i < T; i++)
scanf ("%d", &arr[i]);
for (int i = 0; i <; i++)
{
int J;
for (j = 0; J < T; j + +)
{
char ch = arr[j] ^ dic[i];
if (Ch < ' A ' | | | ch > ' Z ') break
;
}
if (j = = t)
{
for (int j = 0; J < T; j + +)
printf ("%c", Arr[j] ^ dic[i]);
printf ("\ n");
Break
;
}}} return 0;
}