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 Indro_BU Cpp 0.00s
05 mahrahat Cpp 0.00s
06 onucsecu Cpp 0.01s
07 mhsjaber Cpp 0.01s
08 Core_i14 Cpp 0.01s
09 Knight_King Cpp 0.01s
10 sjsakib Cpp 0.01s
11 ProMAGFAT Cpp 0.01s
12 Rajan_sust Cpp 0.01s
13 saiful130104 Cpp 0.01s
14 FariD Cpp 0.01s
15 hmtanbir Cpp 0.01s
16 epmahfuz Cpp 0.01s
17 joy25896 Cpp 0.01s
18 imAnik Cpp 0.01s
19 Saimum_140128 Cpp 0.01s
20 sadia2427 Cpp 0.01s
21 ash12 Cpp 0.01s
22 parthapratimbanik Cpp 0.01s
23 Mahbub_Rahman Cpp 0.01s
24 ammasum Cpp 0.01s
25 haasib Cpp 0.01s
26 emrul Cpp 0.01s
27 Rahat_BU Cpp 0.01s
28 adil_reza Cpp 0.02s
29 rummanrakib11 Cpp 0.02s
30 sabbir_cse14 Cpp 0.02s
31 Salty_Coder Cpp 0.02s
32 atmfaisal Cpp 0.02s
33 orvi2015 Cpp 0.02s
34 md_borhan Cpp 0.02s
35 momin12 Cpp 0.02s
36 shahad_mahmud Cpp 0.02s
37 ozone Cpp 0.02s
38 jualahmed Cpp 0.02s
39 rashedul007 CSharp 0.06s
40 Islam_Rafat Cpp 0.07s
41 Brokenlog Cpp 0.07s
42 jalal Cpp 0.08s
43 anis Cpp 0.08s
44 Dinar Cpp 0.09s
45 Sabbir2015 Cpp 0.09s
46 mir_lutfur_rahman Cpp 0.16s
47 tanmoycsit CSharp 0.16s
48 ronok_cse Cpp 0.21s
49 Shadab Cpp 0.27s
50 kazinayeem Cpp 0.27s

Your feedback is our precious!

Or call +88 02 9853138 for support