DCP-1: Big Sum Back to All Problems

Medium Math > Big Integer Arithmetic

Anik, a student of mathematics is doing a research for his PhD degree. He thinks if he can complete his work, it will help mankind a lot. But the problem is as part of his research he needs to check sum of two numbers in a special way. The numbers themselves will be big enough plus the sum needs to be done in a reversed way. For example, if two numbers were 24 and 13, we have to first reverse these numbers to make them 42 and 31 and then we have to do the addition so the sum will be 42 + 31 = 73. Afterwards he needs to output the result as reversed again, so the output will be 37 actually. One advantage he has is that the input numbers will never have leading zero. But the resulted sum if has any leading zeroes need to be removed. For example, if we have two numbers such as 911 and 199, then the reversed numbers will be 119 and 991 and the sum will be 119 + 991 = 1110. So, if we reverse, the output should be 0111, but actually we have to consider 111 as output because we should remove all leading zeroes in final output. As it is hard for Anik to check numbers that can be as long as 100 digits, so he wants to hire a freelancer who can write a small program to help him. He will provide a large input file with these number pairs and expects an output file that finds out the reversed sum. He wants the code as well so that he can run it on other data sets in future. Let’s see whether you can do it or not. Input: ------ Input will consist of many number pairs, each on a separate line and the numbers are separated by a comma. The numbers can be as big as 100 digits long. The numbers will be integer and factional numbers and negative numbers will not be in input. Input will be terminated by end of file. Output: ------- The output will be the reversed sums each on an individual line of its own. For each input pair, there should be one reversed sum. Sample Input ------------ 199,911 119,991 24,13 Sample Output ------------- 111 111 37

Problem Setter:

MD. Jalal Uddin

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C/C++ 1.00
Java 3.00
C# 3.00
PHP 3.00

Problem Stats




# User Language Timing
01 shahed_shd Cpp 0.00s
02 maxhasan Cpp 0.00s
03 jayed_al_hasan Cpp 0.00s
04 mahrahat Cpp 0.00s
05 Indro_BU Cpp 0.00s
06 ammasum Cpp 0.01s
07 ash12 Cpp 0.01s
08 parthapratimbanik Cpp 0.01s
09 Mahbub_Rahman Cpp 0.01s
10 haasib Cpp 0.01s
11 emrul Cpp 0.01s
12 Rahat_BU Cpp 0.01s
13 adil_reza Cpp 0.02s
14 rummanrakib11 Cpp 0.02s
15 sabbir_cse14 Cpp 0.02s
16 Salty_Coder Cpp 0.02s
17 atmfaisal Cpp 0.02s
18 momin12 Cpp 0.02s
19 jualahmed Cpp 0.02s
20 Islam_Rafat Cpp 0.07s
21 Brokenlog Cpp 0.07s
22 jalal Cpp 0.08s
23 anis Cpp 0.08s
24 Dinar Cpp 0.09s
25 Sabbir2015 Cpp 0.09s
26 mir_lutfur_rahman Cpp 0.16s
27 tanmoycsit CSharp 0.16s
28 ronok_cse Cpp 0.21s
29 Shadab Cpp 0.27s
30 kazinayeem Cpp 0.27s
31 mahbub07 Cpp 0.33s
32 Md_Abid Cpp 0.34s
33 arif2603 Cpp 0.35s
34 shahir_099 Cpp 0.39s
35 froghramar Cpp 0.39s
36 astrolion7 Cpp 0.40s
37 MamunAmin Cpp 0.40s
38 akazad_cse13_ruet Cpp 0.40s
39 shahir099 Cpp 0.40s
40 Ishrak Cpp 0.41s
41 naim2711 Cpp 0.41s
42 moshiur_cse15 Cpp 0.41s
43 Sakib1061 Cpp 0.41s
44 rayhan50001 Cpp 0.41s
45 sajal_khan Cpp 0.42s
46 M3talicana Cpp 0.42s
47 subhashis_cse Cpp 0.42s
48 Masum_ice Cpp 0.42s
49 dip_BRUR Cpp 0.42s
50 tariqiitju Cpp 0.43s

Your feedback is our precious!

Or call +88 02 9853138 for support