A plus B... again
Given two integers A and B (of no more than 100000 digits each), find their exact sum.
All Submissions
Best Solutions
Point Value: 15
Time Limit: 3.00s
Memory Limit: 16M
Added: Oct 24, 2008
Languages Allowed:
C++03, PAS, C, ASM, C#, C++11






Comments (Search)
1 + 9
99 + 1
-99 - 1
100 - 1
1 - 11
123456789 + 987654321
Good luck!
What happened to the test cases
Java has a built-in BigInteger class. A sample Java solution for this problem is as follows: [code]import java.util.Scanner; import java.math.BigInteger; public class aplusb2 { public static void main(String[] foo) { Scanner in = new Scanner(System.in); System.out.println((new BigInteger(in.next())).add(new BigInteger(in.next()))); } }[/code]public static void main(String[] args)
and
public static void main(String[] foo)?
isnt it just like the first one?
[s]The program is not working! Is there a catch? I have used the same program as the first A + B. For Some reason it no work! Its very Simple![/s] _________________ [code]var [s]a,b:integer; begin readln (a); readln (b); writeln (a+b); end.[/code] [/s] nothing to see here :whistle:Is there a catch? I have used the same program as the
first A + B.
For Some reason it no work!
Its very Simple!
_________________
nothing to see here
Integers only have a capacity of -231 to 231 -1 which is 10 digits long while this problem has input that may be up to 100 000 digits each. So you'll have to find another method to solve this. For future reference don't post your code in the comments and please refer to this before posting a question.
http://wcipeg.com/comments/view#comment3719
Note that python is disallowed because it has bignums.