View Code of Problem 3497

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		BigInteger a1,a2,a3;
		while(sc.hasNext())
		{
			BigInteger tem=new BigInteger("0");
			a1=sc.nextBigInteger();
			a2=sc.nextBigInteger();
			a3=sc.nextBigInteger();
			for(int i=3;i<=99;i++)
			{
			    tem=a1.add(a2).add(a3);
			    a1=a2;
			    a2=a3;
			    a3=tem;
			}
			System.out.println(tem);
	    }
	}

}

Double click to view unformatted code.


Back to problem 3497