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 1.00
C++ 1.00
C++14 1.00
C# 3.00
Go 3.00
Java 3.00
JavaScript 3.00
Objective-C 3.00
Perl 3.00
PHP 3.00
Python 3.00
Python3 3.00
Ruby 3.00
VB.Net 3.00

Problem Stats

272/2074

Solve/Submission

Ranking

# User Language Timing
01 MRoy Cpp 0.00s
02 jonyroy Cpp14 0.00s
03 MAHRahat Cpp14 0.00s
04 maxhasan Cpp14 0.00s
05 Reayz Cpp 0.00s
06 afzalul Cpp14 0.00s
07 shahed_shd Cpp14 0.00s
08 Indro_BU Cpp14 0.00s
09 ss1230 Cpp 0.00s
10 sirpoka Cpp14 0.00s
11 jayed_al_hasan Cpp14 0.00s
12 ashikur_rahman Cpp14 0.00s
13 milon019 C 0.00s
14 Ehsanul_Fahad Cpp 0.00s
15 Morass Cpp14 0.00s
16 deloar1 Cpp 0.00s
17 Roll_no_152 Cpp 0.00s
18 wayne6172 C 0.00s
19 fadilcse5bu Cpp 0.00s
20 marayhan C 0.00s
21 SugiuraAyano C 0.00s
22 Neon10 Cpp14 0.01s
23 abdullahaahnaf1 Cpp 0.01s
24 shifa33 Cpp 0.01s
25 1704107_Imran Cpp 0.01s
26 selepsy Cpp 0.01s
27 ahoteshanul Cpp 0.01s
28 mirrafa Cpp 0.01s
29 armanferdous Cpp 0.01s
30 Phenomenal_1_Riad C 0.01s
31 islam2366 C 0.01s
32 nafischonchol Cpp 0.01s
33 triangle Cpp 0.01s
34 shameemreza Cpp 0.01s
35 Riaz_BSMRSTU Cpp14 0.01s
36 RRizkiR Cpp 0.01s
37 sazzad33r C 0.01s
38 tarikul_4152 Cpp 0.01s
39 twyu0721 C 0.01s
40 Shahriar_88 Cpp14 0.01s
41 rithu Cpp14 0.01s
42 abdulmukit Cpp 0.01s
43 rakib_cou Cpp 0.01s
44 Ziaul Cpp14 0.01s
45 nasib_mbstu Cpp 0.01s
46 mahmud2690 Cpp14 0.01s
47 hmtanbir Cpp14 0.01s
48 sb_rithu Cpp14 0.01s
49 porag Cpp14 0.01s
50 Shadman77 Cpp 0.01s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support