Online Judge - 10019 - Funny Encryption Method
Online Judge - 10019 - Funny Encryption Method
A student from ITESM Campus Monterrey plays with a new encryption method for numbers. These method consist of the following steps:
Steps | Example |
|---|---|
1. Read the number N to encrypt | M = 265 |
2. Interpret N as a decimal number | X_1 = 265\ (\text{decimal}) |
3. Convert the decimal interpretation of N to its binary representation | X_1 = 100001001\ (\text{binary}) |
4. Let b_1 be equal to the number of 1’s in this binary representation | b_1 = 3 |
5. Interpret N as a Hexadecimal number | X_2 = 265\ (\text{hexadecimal}) |
6. Convert the hexadecimal interpretation of N to its binary representation | X_2 = 1001100101 |
7. Let b_2 be equal to the number of 1’s in the last binary representation | b_2 = 5 |
8. The encryption is the result of M \operatorname{xor} (b_1 \times b_2) | 265 \operatorname{xor} (3 \times 5) = 262 |
This student failed Computational Organization, thats why this student asked the judges of ITESM Campus Monterrey internal ACM programming Contest to ask for the numbers of 1’s bits of this two representations so that he can continue playing.
You have to write a program that read a Number and give as output the number b_1 and b_2
輸入說明
The first line will contain a number N which is the number of cases that you have to process. Each of the following N Lines
will contain the number M
(in decimal representation) which is the number the student wants to encrypt.
輸出說明
You will have to output N lines, each containing the number b_1 and b_2 in that order, separated by one space corresponding to that lines number to crypt
輸入輸出範例
範例 1
3 265 111 1234
3 5 6 3 5 5
範例 2
4 1 10 15 16
1 1 2 1 4 3 1 3
範例 3
4 100 255 9090 9999
3 1 8 5 5 4 8 8
討論
目前還沒有討論文章。
最近提交
目前還沒有提交紀錄。
登入後即可撰寫程式、測試範例及提交解答。
登入