13487 - Big Integer   

Description

In C and C++, an integer (int) is represented by 32 bits, which has the range of [-231, 231-1]=[-2147483648, 2147483647]. However,  some high level language such as Python can handle arbitrarily large numbers. In this problem, you are asked to design a class called INT with the following constrains and features:

  1. Stores an unsigned integer within the range of [0, 101000)
  2. Overload the operator + to support addition without using traditional function.
  3. Overload the operator = to copy the data
  4. Overload the operator >> and << to support cin and cout.

The idea of overloading operators is to operate your class like existing data type such as int.

The following is a sample code of using the class. For more details, please refer to main.cpp and function.h.

INT a, b, c;
cin >> a;
cin >> b;
c = a + b;
cout << c << endl;
// Input:
123123123123123123123123123123
987654321
987654321987654321987
// Output:
1110777445110777445110777445110

Input

There are two lines. Each line has a single integer.

No leading 0's are given in the test cases. E.g. 0001239487. 

The length of the integer is at most 1000 characters.

Output

Compute and output the sum of the two integers.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13487.cpp

Partial Judge Header

13487.h

Tags




Discuss