The document describes a secret numerical code that is used to open a sarcophagus. If an incorrect code is entered, the contents would be destroyed. The code was originally stored in the Alexandrian Library, but after it burned down, an archaeologist obtained a copy and encoded the numbers in a complex number system using a random base B. The goal is to decrypt the given encoded number X by expressing it in the number system with the given base B.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
74 views1 page
1 - CODE1 - Secret Code
The document describes a secret numerical code that is used to open a sarcophagus. If an incorrect code is entered, the contents would be destroyed. The code was originally stored in the Alexandrian Library, but after it burned down, an archaeologist obtained a copy and encoded the numbers in a complex number system using a random base B. The goal is to decrypt the given encoded number X by expressing it in the number system with the given base B.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
The Sarcophagus itself is locked by a secret numerical code.
When somebody wants
to open it, he must know the code and set it exactly on the top of the Sarcopha gus. A very intricate mechanism then opens the cover. If an incorrect code is en tered, the tickets inside would catch fire immediately and they would have been lost forever. The code (consisting of up to 100 integers) was hidden in the Alex andrian Library but unfortunately, as you probably know, the library burned down completely. But an almost unknown archaeologist has obtained a copy of the code something du ring the 18th century. He was afraid that the code could get to the wrong people '' so he has encoded the numbers in a very special way. He took a random complex number B that was greater (in absolute value) than any of the encoded numbers. Then he counted the numbers as the digits of the system with basis B. That means the sequence of numbers an, an-1, ..., a1, a0 was encoded as the number X = a0 + a1B + a2B2 + ...+ anBn. Your goal is to decrypt the secret code, i.e. to express a given number X in the number system to the base B. In other words, given the numbers X and Byou are t o determine the digit'' a0 through an. Input The input consists of T test cases (equal to about 100000). The number of them ( T) is given on the first line of the input file. Each test case consists of one single line containing four integer numbers Xr, Xi, Br, Bi (|Xr|,|Xi| <= 1000000 , |Br|,|Bi| <= 16). These numbers indicate the real and complex components of nu mbers X and B, i.e. X = Xr + i.Xi, B = Br + i.Bi. B is the basis of the system ( |B| > 1), X is the number you have to express.