import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { BigInteger a = scan.nextBigInteger(); BigInteger b = scan.nextBigInteger(); BigInteger c = scan.nextBigInteger(); BigInteger sum = null; for (int i = 3; i <= 99; i++) { sum = a.add(b).add(c); a = b; b = c; c = sum; } System.out.println(sum.toString()); } } } |
Double click to view unformatted code.