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