618 - I2P2014_Yang_Lab_3 Scoreboard

Time

2014/10/09 13:40:00 2014/10/09 14:40:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10103 Lab_3

10103 - Lab_3   

Description

The input contains fifteen different integer numbers, which are 1 to 15 in some random order. Consider, for example, a sequence: 4 3 7 9 15 14 2 1 5 8 11 6 10 12 13. In this sequence, starting from the first place, we get the number 4. It indicates that the next number we need to pick is at the 4th place, which is 9. Likewise, we then go to the 9th place and get the number 5. We repeat this process until we go to a place that has already been visited. In this example, we will stop at the 8th place and get the number 1, because we have found a circle. Therefore, along the way we pick eight numbers, 4 9 5 15 13 10 8 1.

In this problem, you will be given such a sequence of fifteen numbers. Follow the above visiting rule, please

1.      get the corresponding sequence of numbers;

2.      calculate their sum;

3.      convert their decimal representation into hexadecimal representation as the output. For example, the sum of the above instance is 65. Their hexadecimal representation is 41.

Note that we always start from the first place.

Note that, for example, if the sum of these numbers is 95, your hexadecimal number should be 5F. 

decimal hexadecimal decimal hexadecial
0 0 8 8
1 1 9 9
2 2 10 A
3 3 11 B
4 4 12 C
5 5 13 D
6 6 14 E
7 7 15 F

 

 

 

Input

 A random sequence of the fifteen different numbers of 1 to 15, which are separated by blanks.

Output

The hexadecimal representation of the sum of the numbers being visited.
Remember to print a ' ' at the end of the answer.

Sample Input  Download

Sample Output  Download

Tags




Discuss