ARBITRARY PRECISION ARITHMETICProblem code: DSPC301 |
All submissions for this problem are available.
ARBITRARY PRECISION ARITHMETIC
Every Programming Language defines some datatypes. Most famous datatypes in the world of programming are the primitive datatypes such as Integer and Char. However, for implementation and memory management issues these sizes of these datatypes are fixed.
Though fixing the size of datatypes is simple, it has its own disadvantages. The two major disadvantages are Overflow and Precision-Compensation.
In many Cryptographic applications and also in various mathematical applications such as calculation of values of irrational numbers such as π, it becomes necessary to override the fixed size of the datatype. This is done by the use of Arbitrary Precision Numbers, whose digits of precision are limited only by the available memory of the host system.
Your task is to write a program that adds two arbitrary precision signed numbers.
Note: The only allowed languages are C and C++
©Vishal Gupta
Input:
First line contains number of test cases, integer n < 20.Each test contains two signed integers on two lines of arbitrary length. Number of digits of the arbitrary precision numbers may extend upto 1000000.
Output:
You need to print the sum of the two arbitrary precision signed numbers.
Sample Input:
4
43789743298749823748374982374
-8349328423487287236483487236482734
4382749374923749238749234982364
-90834789348732648723
-9878947468732648374
48738479234239423840823
-982347983479832748932748923
-5664879843749837248972398472398
Sample Output:
-8349284633743988486659738861500360
4382749374832914449400502333641
48728600286770691192449
-5665862191733317081721331221321
| Author: | ganesha |
| Date Added: | 27-03-2010 |
| Time Limit: | 7 sec |
| Source Limit: | 70000 Bytes |
| Languages: | C, C99 strict, CLOJ, CPP 4.0.0-8, CPP 4.3.2, F#, GO, PERL6, PYTH 3.1.2, TEXT |
Comments

Fetching successful submissions

my program is running well on
my program is running well on machine but i am getting runtime error.........i am using only 1.6mb memory i chkd on my submission page and getting 0.00 time................ could anybody tell me why it is happening.... i am using dev c++ on my machine....
i got my error could any body
i got my error could any body tell me what is the time limit.....??
@admiin could you specify
@admiin
could you specify the tiime limit for this problem...??
@ Organisers First of all ,
@ Organisers
First of all , thank you for organising the contest. I really enjoyed solving the problems. One thing i esp. liked about the contest was the level of the questions, which being not that hard enticed you to try your hand at them. However , i have a few suggestions to make.
1. Like some users, i too found that the language in the problems at times was misleading or the problems lacked definiteness . In my opinion, the problems with clear and well defined goal but difficult to write (in algorithm) are better than the ones where the trick involves interpreting the problem in the right way.
2. Please decide on the test cases before the contest and freeze them to whatever they are ( weak or not but otherwise correct ). Changing them in an ongoing contest would just lead to people getting frusterated ... as it happened here.
3. I really don't think using the number of submissions is a great way to judge a winner in a tie, esp. since you can create a fake account in a jiffy to test your problems on. Instead if possible, include a tie-breaker question like codechef's monthly competition. Judging on time/resources is the same thing ... but a tie-breaker is a neat solution for ties.
Well said, Antarpreet.After
Well said, Antarpreet.
After changing test data of "prime triples", organizers informed us.
But i got frustrated , when i saw my AC submission as TLE in problem "S L LONEY" . Organizers changed test data of this problem also without informing us.
@Surendra Input Files for
@Surendra
Input Files for Prime Triples were not changed. I just mailed to help people solve that Question.Input/Output files were changed for R D Sharma and was communicated. The problem was rejugded.
@ Vishal: Sir can you give
@ Vishal:
Sir can you give more details about the event and its forthcoming contests?
@Antarpreet Rules are decided
@Antarpreet
Rules are decided prior to contest; they were mentioned as Guidelines 3 days before the contest began. You should have communicated then.
However, the good news is that, since not many people are tied at the top positions, people with 10 correct submissions are declared winners for the contest. And those with 9 correct submissions are runner-ups.
@ALL However, don't assume
@ALL
However, don't assume the CodeChef rankings as of now. We are yet to make the Submissions Public by All Contestants. If any one is found sharing codes or using any other mal-practices. They'll be disqualified.
@Vishal Please , visit your
@Vishal
Please , visit your mail box.
@Vishal .. I didn't know who
@Vishal ..
I didn't know who to contact before the contest started and i didn't want to comment while the contest was still on (didn't want to give anyone any ideas). Anyway, neither of my suggestions were for the current contest .. they were just requests from my side for any future contests that you may conduct :)
@Surendra
Yeah, i saw the TLE on your solution for S L Loney , weird that it happened. It definitely isn't fair :/