 # CDIT03 - Editorial

Practice

Contest

Author: Hardik Singh Negi

Tester: Amandeep Singh

Editorialist: Akshay Sharma

EASY-MEDIUM

Arrays

### PROBLEM:

That computer gives a token, which consists of space separated elements. The
elements are numbers each ranging from 0 to 9. The encryption can be broken
by constructing a number with the given elements in the order given by the computer and
adding the reverse of that number to the original number. The sum so obtained is the key
to break the encryption.

### QUICK EXPLANATION:

The tokens given by the computer is joined and formed a number. The number is then reversed and added with the original number. The sum is the answer to the problem.

### EXPLANATION:

Initialize a variable with first input which is the number of test cases.

For each test case we initialized sz equal the the size given by next line input.

Now we store every element one by one in an array. The array now has the number formed by joining the numbers.

Now, we add first element by last, second element by second last and so on using a loop. Here, we must have a variable that takes care of the carry value and pass it on to next iteration for addition of next digits. We must also check if the sum we get by adding two numbers is single digit or double, if it is single we leave it as it is and carry is 0, but if it is double, we make first digit as carry and second as the sum.

We store this result in an array which starts filling in reverse order as we add from backward.
Finally our array has the desired result, the key to break the code, print it and help Indian Intelligence.

### AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

Tester’s solution can be found here.