You must create a class big integer for you to solve this problem in C++

You calculate f2 by this formula: f2 = f1 + f0

f2 may be small enough to be stored by an integer, but f1 and f0 may be very large.

For example:

1 = (-2935892358923598) + (2935892358923599)

Re: You must create a class big integer for you to solve this problem in C++

Since you know that

−2·109 ≤ Fk ≤ 2·109 (k = min(i, j, n), …, max(i, j, n)),

the problem is solvable with usual int