View Code of Problem 3497

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 tmp = null ;
			for (int i = 3; i <= 99; i++) {
				tmp = a.add(b).add(c);
				a = b;
				b = c;
				c = tmp;
			}
			System.out.println(tmp.toString());
		}
	}
}

Double click to view unformatted code.


Back to problem 3497