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

100/1052

Solve/Submission

Ranking

# 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 ammasum Cpp 0.01s
12 imAnik Cpp 0.01s
13 Saimum_140128 Cpp 0.01s
14 sadia2427 Cpp 0.01s
15 ash12 Cpp 0.01s
16 parthapratimbanik Cpp 0.01s
17 Mahbub_Rahman Cpp 0.01s
18 haasib Cpp 0.01s
19 emrul Cpp 0.01s
20 Rahat_BU Cpp 0.01s
21 adil_reza Cpp 0.02s
22 rummanrakib11 Cpp 0.02s
23 sabbir_cse14 Cpp 0.02s
24 Salty_Coder Cpp 0.02s
25 atmfaisal Cpp 0.02s
26 orvi2015 Cpp 0.02s
27 md_borhan Cpp 0.02s
28 momin12 Cpp 0.02s
29 ozone Cpp 0.02s
30 jualahmed Cpp 0.02s
31 rashedul007 CSharp 0.06s
32 Islam_Rafat Cpp 0.07s
33 Brokenlog Cpp 0.07s
34 jalal Cpp 0.08s
35 anis Cpp 0.08s
36 Dinar Cpp 0.09s
37 Sabbir2015 Cpp 0.09s
38 mir_lutfur_rahman Cpp 0.16s
39 tanmoycsit CSharp 0.16s
40 ronok_cse Cpp 0.21s
41 Shadab Cpp 0.27s
42 kazinayeem Cpp 0.27s
43 mahbub07 Cpp 0.33s
44 Md_Abid Cpp 0.34s
45 arif2603 Cpp 0.35s
46 shahir_099 Cpp 0.39s
47 froghramar Cpp 0.39s
48 astrolion7 Cpp 0.40s
49 MamunAmin Cpp 0.40s
50 akazad_cse13_ruet Cpp 0.40s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support