View Code of Problem 3497

import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in =new Scanner(System.in);
		while(in.hasNext()) {
			BigInteger a1=in.nextBigInteger();
			BigInteger a2=in.nextBigInteger();
			BigInteger a3=in.nextBigInteger();
			BigInteger an = BigInteger.ZERO;
			for(int i =4;i<=100;i++) {
				an = a3.add(a2).add(a1);
				a1=a2;
				a2=a3;
				a3=an;			
			}
			System.out.println(an);
		}
	}
}

Double click to view unformatted code.


Back to problem 3497