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 fractional 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

125/1167

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 ashikur_rahman Cpp 0.00s
07 afzalul Cpp 0.00s
08 Nazmul0092 Cpp 0.01s
09 feodorv Cpp 0.01s
10 SKL12 Cpp 0.01s
11 porag Cpp 0.01s
12 Dark_Ocean Cpp 0.01s
13 anik_JU Cpp 0.01s
14 Emdadul_Hoque Cpp 0.01s
15 ammasum Cpp 0.01s
16 onucsecu Cpp 0.01s
17 mhsjaber Cpp 0.01s
18 Core_i14 Cpp 0.01s
19 Knight_King Cpp 0.01s
20 sjsakib Cpp 0.01s
21 ProMAGFAT Cpp 0.01s
22 Rajan_sust Cpp 0.01s
23 saiful130104 Cpp 0.01s
24 FariD Cpp 0.01s
25 hmtanbir Cpp 0.01s
26 epmahfuz Cpp 0.01s
27 joy25896 Cpp 0.01s
28 imAnik Cpp 0.01s
29 Saimum_140128 Cpp 0.01s
30 sadia2427 Cpp 0.01s
31 ash12 Cpp 0.01s
32 parthapratimbanik Cpp 0.01s
33 Mahbub_Rahman Cpp 0.01s
34 haasib Cpp 0.01s
35 emrul Cpp 0.01s
36 Rahat_BU Cpp 0.01s
37 adil_reza Cpp 0.02s
38 rummanrakib11 Cpp 0.02s
39 sabbir_cse14 Cpp 0.02s
40 Salty_Coder Cpp 0.02s
41 atmfaisal Cpp 0.02s
42 orvi2015 Cpp 0.02s
43 md_borhan Cpp 0.02s
44 momin12 Cpp 0.02s
45 shahad_mahmud Cpp 0.02s
46 ozone Cpp 0.02s
47 jualahmed Cpp 0.02s
48 smriad Cpp 0.02s
49 asalam345 Cpp 0.02s
50 rashedul007 CSharp 0.06s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support