Hdoj1287_ decipher the code.

Source: Internet
Author: User
Tags printf first row uppercase letter
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;
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.