All submissions for this problem are available.
Mirrored number is a number written in decimal numerals but we reverse the order of digits. The
last digit becomes first and vice versa. For instance, if the number is 4628
the number becomes 8264 of now. Note that all the leading zeros are omitted. That means if the
number ends with a zero, the zero is lost by mirroring (e.g. 1400 gives 41). Another point to note is that there will be no trailing zeroes in the mirrored numbers.
QUARK managers need to calculate with mirrored numbers. Your task is to add two mirrored numbers and
output their mirrored sum. Of course, the result is not unique because any particular number is a
mirrored form of several numbers (e.g. 41 could be 14, 140 or 1400 before mirroring). Thus we must
assume that no zeros were lost by mirroring (e.g. assume that the original number was 14).
The input has N cases. The first line of the input consists of only one positive integer N. After which follow
the N cases. Each case consists of exactly one line which has two positive integers separated by a space. These
are the mirrored numbers which you are required to add. Numbers will be at most 250 digits long.
For each case, print exactly one line containing only one integer — the mirrored sum of two mirrored
numbers. Omit any leading zeros in the output.
|Time Limit:||- 1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions